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

RadCombobox validate data from dropdown and text

2 Answers 44 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Emilia
Top achievements
Rank 1
Emilia asked on 30 May 2014, 12:12 PM
I have a radcombobox and allowcustomtext is true. Is there a property to validate the entered text with the drop down items. Dropdown items are from database and I want if the entered text is different from database data to show error message.

Thank you!

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 02 Jun 2014, 03:49 AM
Hi Emilia,

Please try to attach the OnClientTextChange event of RadComboBox and compare the entered text with the items in the RadComboBox, if no match is found then display an alert message.

JavaScript:
function Validate(sender, args) {
    var flag = 0;
    for (var i = 0; i < sender.get_items().get_count(); i++) {
        if (sender.get_items()._array[i].get_text() == sender.get_text())
            flag = 1;
    }
    if (flag == 0) {
        alert(sender.get_text() + " is not present in the list");
        sender.clearSelection();
    }
}

Thanks,
Princy.
0
Emilia
Top achievements
Rank 1
answered on 09 Jun 2014, 10:31 AM
Thank you for your answer and example!
Tags
ComboBox
Asked by
Emilia
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Emilia
Top achievements
Rank 1
Share this question
or