It’s a shame that such a powerful framework as ExtJs 4 does not have this feature built-in.
function submitOnEnter(field, event) {
if (event.getKey() == event.ENTER) {
field.up('form').getForm().submit();
}
}
var form = Ext.create('Ext.form.Panel', {
...
defaults: {
...
listeners: {
specialkey: submitOnEnter
}
},
submit: function() {
// Your submit code
}
});
The above code automatically adds the listener to every field in the form. Alternatively you may do it yourself:
items: [{
fieldLabel: 'Email',
name: 'email',
vtype: 'email',
maxLength: 64,
allowBlank: false,
listeners: {
specialkey: submitOnEnter
}
}]

hello thanks for posting
It would be too powerful if it did.
That’s why I hate ExtJS. HTML native forms does this automatically, while in ExtJS you should write code, and a pretty dirty code.
It works man, save my time! Now I didn’t need to put listeners in every field.