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

How to Prevent users from pasting data into RadComboBox?

1 Answer 73 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Prasad
Top achievements
Rank 1
Prasad asked on 23 Apr 2012, 05:47 PM
Hi All,

Markup of my radcombobox looks like the following. Even with the following configuration, users are able to paste invalid data into RadComboBox. Can someone please let me know a way to prevent that?

Regards,
Prasad
<telerik:RadComboBox ID="rcbDepartment" runat="server"  Width="200px"
           EmptyMessage="Any Department"  DataTextField="text" DataValueField="value"
           AutoCompleteSeparator=";"  AllowCustomText="false"
           MarkFirstMatch="true"  > </telerik:RadComboBox>        

1 Answer, 1 is accepted

Sort by
0
Ivana
Telerik team
answered on 26 Apr 2012, 11:27 AM
Hello Prasad,

Here is what you can try to overcome this behavior:
function clientLoad(sender, args) {
    var input = sender.get_inputDomElement();
    input.addEventListener("paste", pasteHanlder);
}
 
function pasteHanlder(e) {
    return false;
}
<telerik:RadComboBox ID="rcbDepartment" runat="server" Width="200px" EmptyMessage="Any Department"
    DataTextField="text" DataValueField="value" AutoCompleteSeparator=";" AllowCustomText="false"
    MarkFirstMatch="true" OnClientLoad="clientLoad">
    <Items>
        <telerik:RadComboBoxItem Text="item1" />
        <telerik:RadComboBoxItem Text="item2" />
    </Items>
</telerik:RadComboBox>

I hope this helps.

All the best,
Ivana
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
ComboBox
Asked by
Prasad
Top achievements
Rank 1
Answers by
Ivana
Telerik team
Share this question
or