Hi,
I am trying to listen to keypressed on text field and only when the user press tab to do something.
I did the following:
Code:
var
street =new Ext.form.TextField({
fieldLabel
:'Street',
name
:'street',
enableKeyEvents
:true,
onKeyPress
:function(field, key){
if(key == Ext.EventObject.TAB){
Ext
.MessageBox.alert('key pressed');
}
}
});
I did this because the TextField API show that :
keypress : ( Ext.form.TextField this, Ext.EventObject e )
Keypress input field event. This event only fires if enableKeyEvents is set to true.
Keypress input field event. This event only fires if enableKeyEvents is set to true. Listeners will be called with the following arguments:
- this : Ext.form.TextField This text field
- e : Ext.EventObject
but apperently the second parameter of the function is not EventObject
How can I get the key that was pressed?