PDA

View Full Version : [SOLVED] specialkey event to capture ENTER key in TextArea



efege
25 Oct 2007, 9:57 AM
Hi,

I noticed that an important feature that I need for the usability of my data entry application stopped working in 2.0b1. And I need some help to understand the underlying reason for this -- and solve it too ;)

The problem can be seen "live" on this page:

http://inmabb.criba.edu.ar/varios/tests/textarea-specialkey.html

The actual form has a large number of autosizing textareas, and each textarea can only contain a single line of text (the text may wrap, but no newlines are allowed). So, it's really useful to press ENTER when you want to finish the curent textarea and jump to the next.

As you can see, using a handler for the specialkey event worked with Ext 1.1.1. But the same code under Ext 2.0b1 has no effect at all, as if the ENTER key is not firing this event anymore.

I've been looking at the diffs in the 2 files involved (EventManager.js and Field.js), but that didn't help me.

efege
25 Oct 2007, 10:15 AM
OK, it seems that you can forget about this question :D

The answer came just when I posted my message here. jayWHY (who has just began learning Ext) on the #extjs channel pointed to the file I should have looked at first, which is TextArea.js. This portion of code was added in 2.0:



fireKey : function(e){
if(e.isSpecialKey() && (this.enterIsSpecial || (e.getKey() != e.ENTER || e.hasModifier()))){
this.fireEvent("specialkey", this, e);
}
},


and the default is:



enterIsSpecial : false,


So it's clear what to do now...