PDA

View Full Version : Remove carriage returns from a textarea



jjmusicpro
16 Oct 2014, 6:47 AM
I wanted it so when someone tries to hit enter or do a line break in the text area it wont allow it, i have the code below, and cant find a solution that works
xtype: 'textarea' , labelAlign: 'top' , fieldLabel: 'Administrative Notes' , name: 'description' , height: 100 , maxLength: 1200 }

skab
17 Oct 2014, 12:11 AM
Hey, you may want to look at: http://dev.sencha.com/deploy/ext-4.1.0-gpl/docs/index.html#!/api/Ext.form.field.TextArea-event-specialkey

slemmon
17 Oct 2014, 11:01 PM
Hi,

You can set maskRe and stripCharsRe on the textarea to prevent returns / linebreaks:
http://docs.sencha.com/extjs/4.2.3/#!/api/Ext.form.field.TextArea-cfg-maskRe
http://docs.sencha.com/extjs/4.2.3/#!/api/Ext.form.field.TextArea-cfg-stripCharsRe

c0m