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

[Solved] Onkeypress work in IE but Not in FireBox

3 Answers 111 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
pasam Anna
Top achievements
Rank 1
pasam Anna asked on 19 Nov 2009, 10:44 AM
Hi
This code is working fine in IE.But not working firebox.
I want to get event and keycode in firebox.
is there any other solution for firbox?

function onKeyPressing(sender, eventArgs)  
            {  
                logEvent("Pressed key code: "+ eventArgs.get_domEvent().keyCode);  
            }  
 

3 Answers, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 19 Nov 2009, 05:41 PM
Hello pasam Anna,

In FireFox the pressed key's code can be acquired through event.which, so the code below will work in all browsers:

function onKeyPressing(sender, eventArgs) 
    var domEvent = eventArgs.get_domEvent();
    var keyCode = domEvent.keyCode || domEvent.which;
    logEvent("Pressed key code: "+ keyCode); 
}

Kind regards,
Simon
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
pasam Anna
Top achievements
Rank 1
answered on 20 Nov 2009, 02:20 AM
 
    function OnClientDropDownOpened(sender, eventArgs) 
    { 
    var domEvent = eventArgs.get_domEvent(); 
    var keyCode = domEvent.keyCode || domEvent.which; 
    alert(keyCode); 
}
Hi Simon,
              Thank you very much for your reply.
When I use your code its work fine when i press any key inside combobox.
But When I open combo not
I want to get keycode for when I open dropdown.
In IE When I open dropdown it returns keycode 0
But in Firebox its returns keycode UNDEFINED.






0
Simon
Telerik team
answered on 20 Nov 2009, 11:05 AM
Hi pasam Anna,

This code works only for the key down event of the input because event.which and event.keyCode are defined only then - you cannot access them in the DropDownOpened's domEvent object.

Sincerely yours,
Simon
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
ComboBox
Asked by
pasam Anna
Top achievements
Rank 1
Answers by
Simon
Telerik team
pasam Anna
Top achievements
Rank 1
Share this question
or