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

[Solved] Client event, on Enter?

3 Answers 63 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.
Julien
Top achievements
Rank 1
Julien asked on 21 Feb 2012, 10:40 AM
Hi,

I'm currently using the combobox ( http://demos.telerik.com/aspnet-mvc/combobox/clientsideevents ) and I need to execute a specific method when I press on "enter".

I searched on your event list but I didn't found anything.

I also need that the "enter" triggers the "onChange" event.

How can I do this?

Thank you!!!

3 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 22 Feb 2012, 06:41 PM
Hello Julien,

 
In order to acheive your goal you will need to wire the OnLoad event of the ComboBox. When the combobox loads, you can wire the keydown event of the visible input element and execute the specific method on "enter":

function onLoad() {
    var input = $(this).data("tComboBox").$text;
    input.keydown(function(e) {
          if (e.keyCode == 13) {
                alert("enter");
                $(this).trigger("valueChange"); //trigger the onChange
          }
    });
}


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
Julien
Top achievements
Rank 1
answered on 23 Feb 2012, 08:45 AM
Great!

With this I ended with a working solution! Thank you!

What is the "$text" in fact?
0
Georgi Krustev
Telerik team
answered on 23 Feb 2012, 01:12 PM
Hello Julien,

 
The $text is a jQuery object of the visible input element. It is equivalent to:

var $text = $("#combobox").closest(".t-combobox").find("input:visible");
All the best,
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
Julien
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Julien
Top achievements
Rank 1
Share this question
or