This is a migrated thread and some comments may be shown as answers.

RadComboBox EmptyMessage and AllowCustomText property

1 Answer 127 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Chen Jun Ying
Top achievements
Rank 1
Chen Jun Ying asked on 14 Apr 2010, 07:59 AM
Dear support,

EmptyMessage only displays when AllowCustomText is set to true. Why? If we set AllowCustomText to true, then user can enter any text to the combobox which will bypass my requiredfieldvalidator.

How shall I work around with this?

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 14 Apr 2010, 09:03 AM

Hello Chen,

You can set the AllowCustomText property to True and then prevent the user from typing in the textbox usingclient side code. Here is the code for achieving the functionality;

JavaScript:

 
<script type="text/javascript">   
    function OnLoad(sender, args) {   
        var combo = sender;   
        var input = combo.get_inputDomElement();   
        input.onkeydown = onKeyDownHandler;   
    }   
    function onKeyDownHandler(e) {   
        if (!e)   
            e = window.event;   
        e.returnValue = false;   
        if (e.preventDefault) {   
            e.preventDefault();   
        }   
    }    
</script>  

Also check the following forum link which discussed similar scenario.

EmptyMessage, AllowCustomText and RadComboBox Validation

-Shinu.

Tags
ComboBox
Asked by
Chen Jun Ying
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or