i have implemented validation to combobox using unobstrusive client validation ousing data annotations on model, as described here "http://demos.telerik.com/aspnet-mvc/combobox/clientvalidation "
I see that the validation occurs only on form submit. i would want the validation to happen at control out of focus as-well when tabbed say. could you help. I have tried a number of things that i received on google. did not get any solutions for the same.
Thanks,
Anand
7 Answers, 1 is accepted
Any thoughts yet.
The licence entitles me for a 24 Hr turnover for issues, its been more around 2 days now ! please share your thoughts
Telerik does not guarantee replies to forum posts as they are mainly a community driven resource. Please open a support ticket which has 24 hour guarantee response time when you need timely replies from Telerik
staff.
As to the question - the required functionality is not easy achievable, because the jQuery validates only the input corresponding to the name attribute. As you probably know, the combobox has two inputs:
1. for the selected value, that can be validated and subsequently posted
2. for the selected text which is not validated as it is not required.
After this is said, I believe that you can wire the OnChange event and call validate method of the form.
Georgi Krustev
the Telerik team
Will check the feasiability of the same and getback.
So i am assuming from below suggestion that by default/no direct solution available for a tab out validation. Please correct me if I am mistaken
Unfortunately, there is not direct solution for the required functionality. Let me know if other questions arise.
Georgi Krustev
the Telerik team
The above solution works good. except for that I have a concern. The combo box implemented by me is a search combobox hence while I type the combo box items appear. if i just type in entry fast with incomplete string (any combo box item is yet to appear to be auto selected) then these fail. any thoughts to take care of this delay.
to elaborate more suppose i have countries "US", "UK", and India say on my combo box along with a first item "--Select--"
then if i just type out "--" fast and tab before the combo box search list is populated the text remains at "--" with no corresponding item.
Best regards,
Anand
Depending on the given information, I believe that you need to prevent entering of a custom value in this combobox. If this is the case, then you can wire the OnChange event and prevent entering of a custom value:
function onClientComboChanged(e) { var combo = $(this).data('tComboBox'); if (combobox.value() && combo.selectedIndex < 0) { alert("custom value"); }}Georgi Krustev
the Telerik team
I need the same functionality that telrik combobox having client side validation i.e. if user focus out from the telrik combo box with default selected item then it should raise error message. Can you give me your solution as you say your issue resolved!
Thanks
Amit Shah