PDA

View Full Version : Ext.form.TextArea - How to restore normal Enter key behavior???



jove4015
13 May 2008, 2:59 PM
Hi,

I've got a serious problem with Ext.form.TextArea right now. I have textareas where I really do intend for the user to be able to type multiple lines of text (otherwise, what's the point anyway?).

For some reason I can't find the code for, pressing Enter does not create a new line when Ext creates the text area using Ext.form.TextArea. Instead, it seems you need to press Shift-Enter. In the forum I see a few places where some people seemed to actually request that it work this way... but this is not documented anywhere, really it took a lot of searching around before I could even figure out that Shift-Enter would work.

The problem is, my users are not tech savvy and they will not get this. Even once I explain it to them, all they will do is complain. I'm trying to move them off paper, and MS Word, where pressing Enter creates a new line, like a normal textarea. With this, they will just keeping using Word.... or worse. I'm talking a lot of line breaks here... They're practically writing an essay in this thing, and yes, it does need to be free-form... what they're typing in this textarea can be anywhere from 2 lines to 50, describing a few things or many things, with various different parameters which are too arbitrary to split up into individual fields. They also want to be able to select the whole body of this text and paste it into an e-mail (or vice versa, paste into this from an e-mail), so again, splitting this up into separate form fields is not an option.

Is there any way to get the Ext.form.TextArea to handle the Enter key normally (or, better said, *not* handle the Enter key), or do I need to create all custom elements for this? I've set a breakpoint on every single method of both Ext.form.TextArea and Ext.form.TextField and I can't find anywhere an event handler that would cause this behavior in the first place. I have tried:


Ext.override(Ext.form.TextArea, {
fireKey : function(e){
return true;
});

To try and restore the default behavior, but this does not seem to do anything different.

I've also tried overriding the onKeyUp method, but this has no effect (firebug does not break at this function, ever). Googling returns no relevant information, other than complaints from people who wanted it to work the other way, in order to integrate into the GridEditor... but I am not using a Grid here, this is a plain old FormPanel. I've tried setting some undocumented config options I found in ext-all-debug, like "enterIsSpecial", and "enableKeyEvents", but they also have no effect.

Really, all I want is a plain old normal textarea that gets submitted with the rest of the form, no hassle. Is this possible?

Many thanks to anyone who understands what I'm asking for here...

jove4015
13 May 2008, 3:19 PM
My apologies, it turns out it does work this way by default. My Firefox was simply acting weird - I could not use the tab key either, this is what tipped me off. This would not be the first time my tab key or other keys stopped working in Firefox - jeez, I can't believe how much time I spent on this when all I needed to do was restart Firefox!!!!!! How embarrassing.

Has anyone else had this problem with Firefox before? It's been happening quite frequently lately, where it totally stops responding to certain keys... never noticed it with the Enter key before though! OS X 10.5, FF 2.0.0.14 (I think earlier versions too....)