While using combo box, auto complete, user may enter such value which is not suggested or not in a list. How can we make sure that the user has selected value within the given list.
I understand that I can use drop down list in above scenario. But Want to know the work around for auto complete or combo box.
I was looking at the Server Validation of the combo box Demo, In this demo it gives error "Error! Requested URL didn't return json".
Thanks In Advance,
7 Answers, 1 is accepted
Actually this is the intended behavior of the autocomplete and combobox - to allow custom values to be entered. I also checked the server validation demo - but it didn't display such problems.Perhaps the right way to do this is to perform the check on the server side. The autocomplete and combobox by design allow custom text to be entered so there is no need to prevent that.
the Telerik team
thanks a lot for your input on this. I really appreciate it.
I will try to validate the input on server side.
On server validation demo; If you put enter "xxxxxxx" in Product Name and click on Save, it will return the the error saying "Error! Requested URL didn't return json".
My Mistake. I dont see such error now.
I'm using the ComboBox as a kind of "AutoCompleteWithDropDown" so that the users can search long lists, but I ultimately want them to pick a valid entry.
Rather than extend AutoComplete, I set up a client-side OnChange event that checks the selectedIndex property. If it's < 0, it means that nothing from the list has been selected. Based on that, I disable some other controls on the page.
Probably not exactly what you had in mind in terms of validation, but you might be able to use a similar approach (i.e., before the form posts, do that check and prevent the post from happening and notify the user as you see fit)
Having an autocomplete lookup using the ComboBox with long lists (like a list of US States) while preventing custom values from being entered may not be supported currently, but I am puzzled as to the answer from Telerik here, that "The autocomplete and combobox by design allow custom text to be entered so there is no need to prevent that."
Looking at the RadComboBox AJAX control, preventing custom text isn't anything new with a Telerik ComboBox (http://www.telerik.com/help/aspnet-ajax/combobox-select-existing-item.html).
We are aware that the RadComboBox supports preventing custom text. Unfortunately, this functionality cannot behaves equally in all possible scenarios. For instance, combobox with load on demand could allow custom text if the items are not loaded yet. That is why, we suggest use DropDownList in this case. You can find more information about the components here.
the Telerik team