-
11 Dec 2011 1:21 PM #1
[PR3] Blur event not triggered on Enter/Return key
[PR3] Blur event not triggered on Enter/Return key
If you use the "tab" key to leave the "First Name" field, the BLUR event is correctly triggered but not if you use the "enter/return" key!
Code:Ext.application({ name: '2.0 PR3 Form Test', launch: function() { console.log('launch:'); var myPanel = Ext.create("Ext.Panel", { fullscreen: true, layout: 'fit', items: [ { title: 'Basic', xtype: 'formpanel', id: 'basicform', items: [ { xtype: 'textfield', id: 'firstName', name: 'first', label: 'First' }, { xtype: 'textfield', id: 'lastName', name: 'last', label: 'Last' } ] } ] }); console.log('myPanel=' + myPanel); var firstName = myPanel.down('#firstName'); console.log('firstName=' + firstName); firstName.on({ blur: function() { console.log('BLUR event: firstName.getValue()= ' + firstName.getValue()); } }); } });
-
11 Dec 2011 3:11 PM #2
I believe I found and have a fix for this bug in PR3:
Code:doKeyUp: function(me, e) { var value = me.getValue(); me[value ? 'showClearIcon' : 'hideClearIcon'](); if (e.browserEvent.keyCode === 13) { me.getComponent().blur(); // MY FIX me.fireAction('action', [me, e], 'doAction'); } },
-
12 Dec 2011 12:07 AM #3
Thanks for the report.
Sencha Inc.
Robert Dougan - @rdougan
Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.
-
10 Jan 2012 10:13 AM #4
Why would the blur event fire when you press enter/return? Enter/return normally does nothing in mobile devices, it just stays in the same field - so the field shouldn't blur.
Sencha Inc.
Robert Dougan - @rdougan
Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.
-
10 Jan 2012 10:14 AM #5
If you want to listen to the enter/return key, listen to the `action` event - then blur the field if you want.
Sencha Inc.
Robert Dougan - @rdougan
Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.
Looks like we can't reproduce the issue or there's a problem in the test case provided.


Reply With Quote