Changed Roo/form/NumberField.jsRoo/form/TextField.js
authorAlan <alan@roojs.com>
Wed, 27 Mar 2024 04:30:40 +0000 (12:30 +0800)
committerAlan <alan@roojs.com>
Wed, 27 Mar 2024 04:30:40 +0000 (12:30 +0800)
Roo/form/NumberField.js
Roo/form/TextField.js

index ac0ab79..84cc17d 100644 (file)
@@ -68,10 +68,30 @@ 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.DateField.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) : '';
+        }
+        
+            // prevent input submission
+        
+            
+            
+    },
     // private
     initEvents : function(){
-        Roo.form.NumberField.superclass.initEvents.call(this);
+          
         var allowed = "0123456789";
         if(this.allowDecimals){
             allowed += this.decimalSeparator;
@@ -143,6 +163,11 @@ Roo.extend(Roo.form.NumberField, Roo.form.TextField,  {
        //     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
index d365605..f3e6c74 100644 (file)
@@ -132,9 +132,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);