Thursday, June 25, 2009

Extjs: Using stripCharsRe

Ext js comes with a config option for textarea (maybe also for another form field) that to strip off any unwant character from a value, here is an example of stripping leading white space for the textara field in my form:
           
{
xtype:'textarea',
fieldLabel:'Copy',
id:'copy',
name:'copy',
allowBlank:true,
width:300,
height:50,
stripCharsRe: /^\s+/g, //strip off leading white space
grow: true
}

No comments: