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

[Solved] Alert When Entered Text not Found in Combo List

3 Answers 30 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sam
Top achievements
Rank 1
Sam asked on 06 Jan 2012, 06:31 AM
Hi there,

   We need to give alert when we keyed in text is not found in Combo Box List.
How can we achive this ?


Thanks in Advance..

3 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 06 Jan 2012, 09:15 AM
Hello,

 
You can wire the change event of the combobox and check the value of the selectedIndex:

function onChange(e) {
    var combobox = $(this).data("tComboBox");
    if (combobox.value() && combobox.selectedIndex == -1) {
        alert("custom value is entered");
    }
}

Regards,
Georgi Krustev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Sam
Top achievements
Rank 1
answered on 10 Jan 2012, 11:50 AM
Hi Georgi Krustev,
 
     Thanks for this solution. We were tried this solution before we had posted this query here.
But the problem with this solution is, When we start to enter text in combo box, it will list down matched Items. If we select any one of the matched item by arrow down key and click on enter button. Even though its been selected from the list, selectedIndex become negative and prompt that Custom value is entered.

There is another case: When we start to enter text in combo box and if we have only one matched item. If you click either tab key or enter key now, matched item will be populated into Combo but still selectedIndex become negative only.

Could you please try in above stated way and give us solution..


Thanks.
0
Georgi Krustev
Telerik team
answered on 12 Jan 2012, 11:18 AM
Hello,

 
Straight onto your questions:

#1: I was not able to observe the depicted issue. Check this screencast and let me know if I am missing something.

#2: Thank you for showing this issue. It was fixed immediately (as it is shown in the end of of the screencast). The fixed file is attached to this message. The fix will be included in the next official release of Telerik Extensions for ASP.NET MVC. I have updated your Telerik points.

Kind regards,
Georgi Krustev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
ComboBox
Asked by
Sam
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Sam
Top achievements
Rank 1
Share this question
or