X-Git-Url: http://git.roojs.org/?p=roojs1;a=blobdiff_plain;f=roojs-debug.js;h=e956860183116233b7b90207bfc4348535c8817a;hp=c44698cda55f21a8136068a1a3ffd37fb433b1cd;hb=refs%2Fheads%2Fwip_alan_T5944_trim_leading_white_space_from;hpb=bbea05ba2ddfd77b500f7065e9081f94e407e4d9 diff --git a/roojs-debug.js b/roojs-debug.js index c44698cda5..e956860183 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -39441,6 +39441,10 @@ Roo.extend(Roo.form.TextField, Roo.form.Field, { * @cfg {Boolean} selectOnFocus True to automatically select any existing field text when the field receives input focus (defaults to false) */ selectOnFocus : false, + /** + * @cfg {Boolean} allowLeadingSpace True to prevent the stripping of leading white space + */ + allowLeadingSpace : false, /** * @cfg {String} blankText Error text to display if the allow blank validation fails (defaults to "This field is required") */ @@ -39485,8 +39489,11 @@ Roo.extend(Roo.form.TextField, Roo.form.Field, { if(this.selectOnFocus){ this.on("focus", this.preFocus, this); - } + if (!this.allowLeadingSpace) { + this.on('blur', this.cleanLeadingSpace, this); + } + if(this.maskRe || (this.vtype && this.disableKeyFilter !== true && (this.maskRe = Roo.form.VTypes[this.vtype+'Mask']))){ this.el.on("keypress", this.filterKeys, this); } @@ -39522,7 +39529,11 @@ Roo.extend(Roo.form.TextField, Roo.form.Field, { this.autoSize(); } }, - + // private - clean the leading white space + cleanLeadingSpace : function(e) + { + this.setValue(this.getValue().replace(/^\s+/,'')); + }, /** * Resets the current field value to the originally-loaded value and clears any validation messages. * @@ -39530,9 +39541,7 @@ Roo.extend(Roo.form.TextField, Roo.form.Field, { reset : function(){ Roo.form.TextField.superclass.reset.call(this); - }, - - + }, // private preFocus : function(){