RadCombobox validate data from dropdown and text

3 posts, 0 answers
  1. Emilia
    Emilia avatar
    2 posts
    Member since:
    Sep 2012

    Posted 30 May 2014 Link to this post

    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. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 01 Jun 2014 in reply to Emilia Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Emilia
    Emilia avatar
    2 posts
    Member since:
    Sep 2012

    Posted 09 Jun 2014 in reply to Princy Link to this post

    Thank you for your answer and example!
Back to Top