Given a RadComboBox with search, if the user enters some search text and then clicks on one of the filtered entries in the dropdown list the validation event is fired as the entry box loses focus and results in a 'false' return from validation as it uses the 'Text' property which is the search string. Validation is then refired as a result of clicking on the entry. However, the initial 'false' return can cause unwanted behaviour in code that depends on the validation event. I can supply a sample project demonstrating the problem, but it needs more than the 10 MB upload limit.
Hi Stephen,
Since the popularity of this item is not enough to go into development soon, I am sharing the workaround with the community below:
var isOpened = false;
ValidateComboBoxSelectedItem = function (sender, args) {
args.IsValid = true;
isOpened = !isOpened;
var combo = $find(sender.controltovalidate);
var text = combo.get_text();
var value = combo.get_value();
if (text.length > 0 && isOpened != true) {
var node = combo.findItemByText(text);
if (node || value.length > 0) {
args.IsValid = true;
} else {
args.IsValid = false;
}
}
}
You can use the code above as a base for your implementation and also may need to add more checks depending on the concrete scenarios.
Regards,
Rumen
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.