PDA

View Full Version : Cannot catch the "keypress" and "specialkey" event.



fancing
2 Oct 2010, 10:53 PM
Hi, support team,

i am using ExtJS version 3.2.1, i want to handle the "specialkey" event of a Field to do form submit, but i failed because the event.getKey() always return undefined like this:



'specialkey': function(f, e) {
var key = e.getKey(); // here i always got undefined.
if (e.getKey() == e.ENTER) {
var form = field.ownerCt.getForm();
form.submit();
}
},


Note: It's the same code snippet from Ext Documentation, i used in my code.

Also, i tried to use the "keypress" event of Ext.Element, while i got the same issue.

Could you anyone know about this, is it a bug or my mistake?

Thank you for reply!

Ourysso
4 Oct 2010, 5:05 AM
All listeners and handlers doesn't work on Firefox =/
Last friday the code worked... =/
What is happening?

Condor
4 Oct 2010, 5:18 AM
IMHO this is a much better way to submit a form on enter (http://www.sencha.com/forum/showthread.php?75999-OPEN-771-BasicForm.-submitOnEnter-config).