X-Git-Url: http://git.roojs.org/?p=roojs1;a=blobdiff_plain;f=roojs-debug.js;fp=roojs-debug.js;h=3caba59518a797b748514e5dcb8b42438a8e1247;hp=66736f2de63dfdc23a489d5e1462cda1752608a8;hb=6c9ff83b9aeb60ee31ddcb2ccacc2b72bd3ba647;hpb=83dd319070d3735be6a0001ebccae6cc0a83e2e2 diff --git a/roojs-debug.js b/roojs-debug.js index 66736f2de6..3caba59518 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -43136,9 +43136,9 @@ 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.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); @@ -43904,10 +43904,55 @@ Roo.extend(Roo.form.NumberField, Roo.form.TextField, { * if a valid character like '.' or '-' is left in the field with no number (defaults to "{value} is not a valid number") */ nanText : "{0} is not a valid number", - + + hiddenField : false, + + onRender : function(ct, position) + { + Roo.form.TextField.superclass.onRender.call(this, ct, position); + + //this.el.dom.removeAttribute('name'); + Roo.log("Changing name?"); + if (this.thousandSeparator != '') { + this.el.dom.setAttribute('name', this.name + '____hidden___' ); + this.hiddenField = this.el.insertSibling({ tag:'input', type:'hidden', name: this.name }, + 'before', true); + this.hiddenField.value = this.value ? this.parseValue(this.value) : ''; + this.el.on('blur', this.onBlur, this); + } + + // prevent input submission + + + + }, + onBlur : function(){ + this.beforeBlur(); + if(!Roo.isOpera && this.focusClass){ // don't touch in Opera + this.el.removeClass(this.focusClass); + } + this.hasFocus = false; + if(this.validationEvent !== false && this.validateOnBlur && this.validationEvent != "blur"){ + this.validate(); + } + var v = this.getValue(); + if(String(v) !== String(this.startValue)){ + this.setValue( this.parseValue(v)); + this.fireEvent('change', this, v, this.startValue); + } + this.fireEvent("blur", this); + }, + + // override name, so that it works with hidden field. + getName: function(){ + if (this.thousandSeparator != '') { + return this.name; + } + return Roo.form.TextField.superclass.getName.call(this); + }, // private initEvents : function(){ - Roo.form.NumberField.superclass.initEvents.call(this); + var allowed = "0123456789"; if(this.allowDecimals){ allowed += this.decimalSeparator; @@ -43960,7 +44005,7 @@ Roo.extend(Roo.form.NumberField, Roo.form.TextField, { // private parseValue : function(value){ - value = parseFloat(String(value).replace(this.decimalSeparator, ".").replace(this.thousandSeparator, '')); + value = parseFloat(String(value).replace(this.decimalSeparator, ".").split(this.thousandSeparator).join('')); return isNaN(value) ? '' : value; }, @@ -43976,9 +44021,14 @@ Roo.extend(Roo.form.NumberField, Roo.form.TextField, { setValue : function(v){ v = this.fixPrecision(v); if(this.thousandSeparator != ''){ - // v = Roo.util.Format.number(v, this.decimalPrecision, this.thousandSeparator); + v = Roo.util.Format.number(v, this.decimalPrecision, this.thousandSeparator); } Roo.form.NumberField.superclass.setValue.call(this, String(v).replace(".", this.decimalSeparator)); + if (this.hiddenField !== false) { + this.hiddenField.value = v ? this.parseValue(v) : ''; + } + + }, // private