projects
/
roojs1
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Changed Roo/form/TextField.js
[roojs1]
/
Roo
/
form
/
TextField.js
diff --git
a/Roo/form/TextField.js
b/Roo/form/TextField.js
index
059611e
..
20a8c7d
100644
(file)
--- a/
Roo/form/TextField.js
+++ b/
Roo/form/TextField.js
@@
-83,6
+83,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} 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")
*/
/**
* @cfg {String} blankText Error text to display if the allow blank validation fails (defaults to "This field is required")
*/
@@
-127,8
+131,11
@@
Roo.extend(Roo.form.TextField, Roo.form.Field, {
if(this.selectOnFocus){
this.on("focus", this.preFocus, this);
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);
}
if(this.maskRe || (this.vtype && this.disableKeyFilter !== true && (this.maskRe = Roo.form.VTypes[this.vtype+'Mask']))){
this.el.on("keypress", this.filterKeys, this);
}
@@
-164,7
+171,11
@@
Roo.extend(Roo.form.TextField, Roo.form.Field, {
this.autoSize();
}
},
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.
*
/**
* Resets the current field value to the originally-loaded value and clears any validation messages.
*
@@
-172,9
+183,7
@@
Roo.extend(Roo.form.TextField, Roo.form.Field, {
reset : function(){
Roo.form.TextField.superclass.reset.call(this);
reset : function(){
Roo.form.TextField.superclass.reset.call(this);
- },
-
-
+ },
// private
preFocus : function(){
// private
preFocus : function(){