Fix #7418 - radio button set value
authorAlan <alan@roojs.com>
Fri, 23 Sep 2022 03:41:07 +0000 (11:41 +0800)
committerAlan <alan@roojs.com>
Fri, 23 Sep 2022 03:41:07 +0000 (11:41 +0800)
14 files changed:
Roo/form/BasicForm.js
Roo/form/Checkbox.js
Roo/form/Radio.js
docs/json/roodata.json
docs/src/Roo_form_BasicForm.js.html
docs/src/Roo_form_Checkbox.js.html
docs/src/Roo_form_Radio.js.html
docs/symbols/Roo.form.BasicForm.json
docs/symbols/Roo.form.Form.json
docs/symbols/Roo.form.Radio.json
roojs-all.js
roojs-debug.js
roojs-ui-debug.js
roojs-ui.js

index 67472d0..130319a 100644 (file)
@@ -507,6 +507,9 @@ clientValidation  Boolean          Applies to submit only.  Pass true to call fo
             for(id in values){
                 if(typeof values[id] != 'function' && (field = this.findField(id))){
                     
             for(id in values){
                 if(typeof values[id] != 'function' && (field = this.findField(id))){
                     
+                    
+                    
+                    
                     if (field.setFromData && 
                         field.valueField && 
                         field.displayField &&
                     if (field.setFromData && 
                         field.valueField && 
                         field.displayField &&
@@ -521,6 +524,9 @@ clientValidation  Boolean          Applies to submit only.  Pass true to call fo
                         sd[field.displayField] = typeof(values[field.name]) == 'undefined' ? '' : values[field.name];
                         field.setFromData(sd);
                         
                         sd[field.displayField] = typeof(values[field.name]) == 'undefined' ? '' : values[field.name];
                         field.setFromData(sd);
                         
+                    } else if (field.inputType && field.inputType == 'radio') {
+                        
+                        field.setValue(values[id]);
                     } else {
                         field.setValue(values[id]);
                     }
                     } else {
                         field.setValue(values[id]);
                     }
@@ -546,7 +552,7 @@ clientValidation  Boolean          Applies to submit only.  Pass true to call fo
     /**
      * Returns the fields in this form as an object with key/value pairs. If multiple fields exist with the same name
      * they are returned as an array.
     /**
      * Returns the fields in this form as an object with key/value pairs. If multiple fields exist with the same name
      * they are returned as an array.
-     * @param {Boolean} asString (default false)
+     * @param {Boolean} asString (def)
      * @return {Object}
      */
     getValues : function(asString)
      * @return {Object}
      */
     getValues : function(asString)
index 7093fdd..634c510 100644 (file)
@@ -190,7 +190,9 @@ Roo.extend(Roo.form.Checkbox, Roo.form.Field,  {
             this.fireEvent('check', this, state);
         }
         this.inSetChecked = true;
             this.fireEvent('check', this, state);
         }
         this.inSetChecked = true;
-        this.el.dom.value = state ? this.inputValue : this.valueOff;
+                
+               this.el.dom.value = state ? this.inputValue : this.valueOff;
+                
         this.inSetChecked = false;
         
     },
         this.inSetChecked = false;
         
     },
index 4f83f53..974e543 100644 (file)
@@ -60,7 +60,47 @@ Roo.extend(Roo.form.Radio, Roo.form.Checkbox, {
             this.el.dom.checked =   'checked' ;
         }
          
             this.el.dom.checked =   'checked' ;
         }
          
+    },
+    /**
+     * Sets the checked state of the checkbox.
+     * On is always based on a string comparison between inputValue and the param.
+     * @param {Boolean/String} value - the value to set 
+     * @param {Boolean/String} suppressEvent - whether to suppress the checkchange event.
+     */
+    setValue : function(v,suppressEvent){
+        
+        
+        //this.checked = (v === true || v === 'true' || v == '1' || String(v).toLowerCase() == 'on');
+        //if(this.el && this.el.dom){
+        //    this.el.dom.checked = this.checked;
+        //    this.el.dom.defaultChecked = this.checked;
+        //}
+        this.setChecked(String(v) === String(this.inputValue), suppressEvent);
+        
+        this.el.dom.form[this.name].value = v;
+     
+        //this.fireEvent("check", this, this.checked);
+    },
+    // private..
+    setChecked : function(state,suppressEvent)
+    {
+         
+        if(this.wrap){
+            this.wrap[state ? 'addClass' : 'removeClass']('x-menu-item-checked');
+        }
+        this.checked = state;
+        if(suppressEvent !== true){
+            this.fireEvent('check', this, state);
+        }
+                
+                 
+       
+        
+    },
+    reset : function(){
+        // this.setValue(this.resetValue);
+        //this.originalValue = this.getValue();
+        this.clearInvalid();
     } 
     
     } 
     
-    
 });
\ No newline at end of file
 });
\ No newline at end of file
index 3c8a71c..1914e1d 100644 (file)
           {
             "name" : "asString",
             "type" : "Boolean",
           {
             "name" : "asString",
             "type" : "Boolean",
-            "desc" : "",
+            "desc" : "(def)",
             "isOptional" : false
           }
         ],
             "isOptional" : false
           }
         ],
           {
             "name" : "asString",
             "type" : "Boolean",
           {
             "name" : "asString",
             "type" : "Boolean",
-            "desc" : "",
+            "desc" : "(def)",
             "isOptional" : false
           }
         ],
             "isOptional" : false
           }
         ],
         "desc" : "Sets the checked state of the checkbox.\nOn is always based on a string comparison between inputValue and the param.",
         "sig" : "(value, suppressEvent)",
         "static" : false,
         "desc" : "Sets the checked state of the checkbox.\nOn is always based on a string comparison between inputValue and the param.",
         "sig" : "(value, suppressEvent)",
         "static" : false,
-        "memberOf" : "Roo.form.Checkbox",
+        "memberOf" : "",
         "isStatic" : false,
         "isConstructor" : false,
         "isPrivate" : false,
         "isStatic" : false,
         "isConstructor" : false,
         "isPrivate" : false,
index 1210410..3573f10 100644 (file)
@@ -507,6 +507,9 @@ clientValidation  Boolean          Applies to submit only.  Pass true to call fo
             </span><span class="jsdoc-keyword">for</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">id </span><span class="jsdoc-keyword">in </span><span class="jsdoc-var">values</span><span class="jsdoc-syntax">){
                 </span><span class="jsdoc-keyword">if</span><span class="jsdoc-syntax">(</span><span class="jsdoc-keyword">typeof </span><span class="jsdoc-var">values</span><span class="jsdoc-syntax">[</span><span class="jsdoc-var">id</span><span class="jsdoc-syntax">] != </span><span class="jsdoc-string">'function' </span><span class="jsdoc-syntax">&amp;&amp; (</span><span class="jsdoc-var">field </span><span class="jsdoc-syntax">= </span><span class="jsdoc-var">this.findField</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">id</span><span class="jsdoc-syntax">))){
 
             </span><span class="jsdoc-keyword">for</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">id </span><span class="jsdoc-keyword">in </span><span class="jsdoc-var">values</span><span class="jsdoc-syntax">){
                 </span><span class="jsdoc-keyword">if</span><span class="jsdoc-syntax">(</span><span class="jsdoc-keyword">typeof </span><span class="jsdoc-var">values</span><span class="jsdoc-syntax">[</span><span class="jsdoc-var">id</span><span class="jsdoc-syntax">] != </span><span class="jsdoc-string">'function' </span><span class="jsdoc-syntax">&amp;&amp; (</span><span class="jsdoc-var">field </span><span class="jsdoc-syntax">= </span><span class="jsdoc-var">this.findField</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">id</span><span class="jsdoc-syntax">))){
 
+
+
+
                     </span><span class="jsdoc-keyword">if </span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">field.setFromData </span><span class="jsdoc-syntax">&amp;&amp;
                         </span><span class="jsdoc-var">field.valueField </span><span class="jsdoc-syntax">&amp;&amp;
                         </span><span class="jsdoc-var">field.displayField </span><span class="jsdoc-syntax">&amp;&amp;
                     </span><span class="jsdoc-keyword">if </span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">field.setFromData </span><span class="jsdoc-syntax">&amp;&amp;
                         </span><span class="jsdoc-var">field.valueField </span><span class="jsdoc-syntax">&amp;&amp;
                         </span><span class="jsdoc-var">field.displayField </span><span class="jsdoc-syntax">&amp;&amp;
@@ -521,6 +524,9 @@ clientValidation  Boolean          Applies to submit only.  Pass true to call fo
                         </span><span class="jsdoc-var">sd</span><span class="jsdoc-syntax">[</span><span class="jsdoc-var">field.displayField</span><span class="jsdoc-syntax">] = </span><span class="jsdoc-keyword">typeof</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">values</span><span class="jsdoc-syntax">[</span><span class="jsdoc-var">field.name</span><span class="jsdoc-syntax">]) == </span><span class="jsdoc-string">'undefined' </span><span class="jsdoc-syntax">? </span><span class="jsdoc-string">'' </span><span class="jsdoc-syntax">: </span><span class="jsdoc-var">values</span><span class="jsdoc-syntax">[</span><span class="jsdoc-var">field.name</span><span class="jsdoc-syntax">];
                         </span><span class="jsdoc-var">field.setFromData</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">sd</span><span class="jsdoc-syntax">);
 
                         </span><span class="jsdoc-var">sd</span><span class="jsdoc-syntax">[</span><span class="jsdoc-var">field.displayField</span><span class="jsdoc-syntax">] = </span><span class="jsdoc-keyword">typeof</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">values</span><span class="jsdoc-syntax">[</span><span class="jsdoc-var">field.name</span><span class="jsdoc-syntax">]) == </span><span class="jsdoc-string">'undefined' </span><span class="jsdoc-syntax">? </span><span class="jsdoc-string">'' </span><span class="jsdoc-syntax">: </span><span class="jsdoc-var">values</span><span class="jsdoc-syntax">[</span><span class="jsdoc-var">field.name</span><span class="jsdoc-syntax">];
                         </span><span class="jsdoc-var">field.setFromData</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">sd</span><span class="jsdoc-syntax">);
 
+                    } </span><span class="jsdoc-keyword">else if </span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">field.inputType </span><span class="jsdoc-syntax">&amp;&amp; </span><span class="jsdoc-var">field.inputType </span><span class="jsdoc-syntax">== </span><span class="jsdoc-string">'radio'</span><span class="jsdoc-syntax">) {
+
+                        </span><span class="jsdoc-var">field.setValue</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">values</span><span class="jsdoc-syntax">[</span><span class="jsdoc-var">id</span><span class="jsdoc-syntax">]);
                     } </span><span class="jsdoc-keyword">else </span><span class="jsdoc-syntax">{
                         </span><span class="jsdoc-var">field.setValue</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">values</span><span class="jsdoc-syntax">[</span><span class="jsdoc-var">id</span><span class="jsdoc-syntax">]);
                     }
                     } </span><span class="jsdoc-keyword">else </span><span class="jsdoc-syntax">{
                         </span><span class="jsdoc-var">field.setValue</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">values</span><span class="jsdoc-syntax">[</span><span class="jsdoc-var">id</span><span class="jsdoc-syntax">]);
                     }
@@ -546,7 +552,7 @@ clientValidation  Boolean          Applies to submit only.  Pass true to call fo
     </span><span class="jsdoc-comment">/**
      * Returns the fields in this form as an object with key/value pairs. If multiple fields exist with the same name
      * they are returned as an array.
     </span><span class="jsdoc-comment">/**
      * Returns the fields in this form as an object with key/value pairs. If multiple fields exist with the same name
      * they are returned as an array.
-     * @param {Boolean} asString
+     * @param {Boolean} asString (def)
      * @return {Object}
      */
     </span><span class="jsdoc-var">getValues </span><span class="jsdoc-syntax">: </span><span class="jsdoc-keyword">function</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">asString</span><span class="jsdoc-syntax">)
      * @return {Object}
      */
     </span><span class="jsdoc-var">getValues </span><span class="jsdoc-syntax">: </span><span class="jsdoc-keyword">function</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">asString</span><span class="jsdoc-syntax">)
index 39096f0..b22a8e7 100644 (file)
             </span><span class="jsdoc-var">this.fireEvent</span><span class="jsdoc-syntax">(</span><span class="jsdoc-string">'check'</span><span class="jsdoc-syntax">, </span><span class="jsdoc-var">this</span><span class="jsdoc-syntax">, </span><span class="jsdoc-var">state</span><span class="jsdoc-syntax">);
         }
         </span><span class="jsdoc-var">this.inSetChecked </span><span class="jsdoc-syntax">= </span><span class="jsdoc-keyword">true</span><span class="jsdoc-syntax">;
             </span><span class="jsdoc-var">this.fireEvent</span><span class="jsdoc-syntax">(</span><span class="jsdoc-string">'check'</span><span class="jsdoc-syntax">, </span><span class="jsdoc-var">this</span><span class="jsdoc-syntax">, </span><span class="jsdoc-var">state</span><span class="jsdoc-syntax">);
         }
         </span><span class="jsdoc-var">this.inSetChecked </span><span class="jsdoc-syntax">= </span><span class="jsdoc-keyword">true</span><span class="jsdoc-syntax">;
-        </span><span class="jsdoc-var">this.el.dom.value </span><span class="jsdoc-syntax">= </span><span class="jsdoc-var">state </span><span class="jsdoc-syntax">? </span><span class="jsdoc-var">this.inputValue </span><span class="jsdoc-syntax">: </span><span class="jsdoc-var">this.valueOff</span><span class="jsdoc-syntax">;
+
+               </span><span class="jsdoc-var">this.el.dom.value </span><span class="jsdoc-syntax">= </span><span class="jsdoc-var">state </span><span class="jsdoc-syntax">? </span><span class="jsdoc-var">this.inputValue </span><span class="jsdoc-syntax">: </span><span class="jsdoc-var">this.valueOff</span><span class="jsdoc-syntax">;
+
         </span><span class="jsdoc-var">this.inSetChecked </span><span class="jsdoc-syntax">= </span><span class="jsdoc-keyword">false</span><span class="jsdoc-syntax">;
 
     },
         </span><span class="jsdoc-var">this.inSetChecked </span><span class="jsdoc-syntax">= </span><span class="jsdoc-keyword">false</span><span class="jsdoc-syntax">;
 
     },
index 31049d3..d1feaf9 100644 (file)
             </span><span class="jsdoc-var">this.el.dom.checked </span><span class="jsdoc-syntax">=   </span><span class="jsdoc-string">'checked' </span><span class="jsdoc-syntax">;
         }
 
             </span><span class="jsdoc-var">this.el.dom.checked </span><span class="jsdoc-syntax">=   </span><span class="jsdoc-string">'checked' </span><span class="jsdoc-syntax">;
         }
 
-    }
+    },
+    </span><span class="jsdoc-comment">/**
+     * Sets the checked state of the checkbox.
+     * On is always based on a string comparison between inputValue and the param.
+     * @param {Boolean/String} value - the value to set 
+     * @param {Boolean/String} suppressEvent - whether to suppress the checkchange event.
+     */
+    </span><span class="jsdoc-var">setValue </span><span class="jsdoc-syntax">: </span><span class="jsdoc-keyword">function</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">v</span><span class="jsdoc-syntax">,</span><span class="jsdoc-var">suppressEvent</span><span class="jsdoc-syntax">){
+
+
+        </span><span class="jsdoc-comment">//this.checked = (v === true || v === 'true' || v == '1' || String(v).toLowerCase() == 'on');
+        //if(this.el &amp;&amp; this.el.dom){
+        //    this.el.dom.checked = this.checked;
+        //    this.el.dom.defaultChecked = this.checked;
+        //}
+        </span><span class="jsdoc-var">this.setChecked</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">String</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">v</span><span class="jsdoc-syntax">) === </span><span class="jsdoc-var">String</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">this.inputValue</span><span class="jsdoc-syntax">), </span><span class="jsdoc-var">suppressEvent</span><span class="jsdoc-syntax">);
+
+        </span><span class="jsdoc-var">this.el.dom.form</span><span class="jsdoc-syntax">[</span><span class="jsdoc-var">this.name</span><span class="jsdoc-syntax">]</span><span class="jsdoc-var">.value </span><span class="jsdoc-syntax">= </span><span class="jsdoc-var">v</span><span class="jsdoc-syntax">;
+
+        </span><span class="jsdoc-comment">//this.fireEvent(&quot;check&quot;, this, this.checked);
+    </span><span class="jsdoc-syntax">},
+    </span><span class="jsdoc-comment">// private..
+    </span><span class="jsdoc-var">setChecked </span><span class="jsdoc-syntax">: </span><span class="jsdoc-keyword">function</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">state</span><span class="jsdoc-syntax">,</span><span class="jsdoc-var">suppressEvent</span><span class="jsdoc-syntax">)
+    {
 
 
+        </span><span class="jsdoc-keyword">if</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">this.wrap</span><span class="jsdoc-syntax">){
+            </span><span class="jsdoc-var">this.wrap</span><span class="jsdoc-syntax">[</span><span class="jsdoc-var">state </span><span class="jsdoc-syntax">? </span><span class="jsdoc-string">'addClass' </span><span class="jsdoc-syntax">: </span><span class="jsdoc-string">'removeClass'</span><span class="jsdoc-syntax">](</span><span class="jsdoc-string">'x-menu-item-checked'</span><span class="jsdoc-syntax">);
+        }
+        </span><span class="jsdoc-var">this.checked </span><span class="jsdoc-syntax">= </span><span class="jsdoc-var">state</span><span class="jsdoc-syntax">;
+        </span><span class="jsdoc-keyword">if</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">suppressEvent </span><span class="jsdoc-syntax">!== </span><span class="jsdoc-keyword">true</span><span class="jsdoc-syntax">){
+            </span><span class="jsdoc-var">this.fireEvent</span><span class="jsdoc-syntax">(</span><span class="jsdoc-string">'check'</span><span class="jsdoc-syntax">, </span><span class="jsdoc-var">this</span><span class="jsdoc-syntax">, </span><span class="jsdoc-var">state</span><span class="jsdoc-syntax">);
+        }
+
+
+
+
+    },
+    </span><span class="jsdoc-var">reset </span><span class="jsdoc-syntax">: </span><span class="jsdoc-keyword">function</span><span class="jsdoc-syntax">(){
+        </span><span class="jsdoc-comment">// this.setValue(this.resetValue);
+        //this.originalValue = this.getValue();
+        </span><span class="jsdoc-var">this.clearInvalid</span><span class="jsdoc-syntax">();
+    }
 
 });</span></code></body></html>
\ No newline at end of file
 
 });</span></code></body></html>
\ No newline at end of file
index f220c77..abd6d5f 100644 (file)
         {
           "name" : "asString",
           "type" : "Boolean",
         {
           "name" : "asString",
           "type" : "Boolean",
-          "desc" : "",
+          "desc" : "(def)",
           "isOptional" : false
         }
       ],
           "isOptional" : false
         }
       ],
index 75d14e3..5d461f7 100644 (file)
         {
           "name" : "asString",
           "type" : "Boolean",
         {
           "name" : "asString",
           "type" : "Boolean",
-          "desc" : "",
+          "desc" : "(def)",
           "isOptional" : false
         }
       ],
           "isOptional" : false
         }
       ],
index 49fc788..d41ae41 100644 (file)
       "desc" : "Sets the checked state of the checkbox.\nOn is always based on a string comparison between inputValue and the param.",
       "sig" : "(value, suppressEvent)",
       "static" : false,
       "desc" : "Sets the checked state of the checkbox.\nOn is always based on a string comparison between inputValue and the param.",
       "sig" : "(value, suppressEvent)",
       "static" : false,
-      "memberOf" : "Roo.form.Checkbox",
+      "memberOf" : "",
       "isStatic" : false,
       "isConstructor" : false,
       "isPrivate" : false,
       "isStatic" : false,
       "isConstructor" : false,
       "isPrivate" : false,
index c6f920e..cac12bf 100644 (file)
@@ -1852,7 +1852,8 @@ this.el.on('DOMAttrModified',this.setFromHidden,this);this.el.on('propertychange
 // Roo/form/Radio.js
 Roo.form.Radio=function(){Roo.form.Radio.superclass.constructor.apply(this,arguments);};Roo.extend(Roo.form.Radio,Roo.form.Checkbox,{inputType:'radio',getGroupValue:function(){return this.el.up('form').child('input[name='+this.el.dom.name+']:checked',true).value;
 },onRender:function(ct,A){Roo.form.Checkbox.superclass.onRender.call(this,ct,A);if(this.inputValue!==undefined){this.el.dom.value=this.inputValue;}this.wrap=this.el.wrap({cls:"x-form-check-wrap"});if(this.boxLabel){this.wrap.createChild({tag:'label',htmlFor:this.el.id,cls:'x-form-cb-label',html:this.boxLabel}
 // Roo/form/Radio.js
 Roo.form.Radio=function(){Roo.form.Radio.superclass.constructor.apply(this,arguments);};Roo.extend(Roo.form.Radio,Roo.form.Checkbox,{inputType:'radio',getGroupValue:function(){return this.el.up('form').child('input[name='+this.el.dom.name+']:checked',true).value;
 },onRender:function(ct,A){Roo.form.Checkbox.superclass.onRender.call(this,ct,A);if(this.inputValue!==undefined){this.el.dom.value=this.inputValue;}this.wrap=this.el.wrap({cls:"x-form-check-wrap"});if(this.boxLabel){this.wrap.createChild({tag:'label',htmlFor:this.el.id,cls:'x-form-cb-label',html:this.boxLabel}
-);}if(this.checked){this.el.dom.checked='checked';}}});
+);}if(this.checked){this.el.dom.checked='checked';}},setValue:function(v,A){this.setChecked(String(v)===String(this.inputValue),A);this.el.dom.form[this.name].value=v;},setChecked:function(A,B){if(this.wrap){this.wrap[A?'addClass':'removeClass']('x-menu-item-checked');
+}this.checked=A;if(B!==true){this.fireEvent('check',this,A);}},reset:function(){this.clearInvalid();}});
 // Roo/rtf/namespace.js
 Roo.rtf={};
 // Roo/rtf/Hex.js
 // Roo/rtf/namespace.js
 Roo.rtf={};
 // Roo/rtf/Hex.js
@@ -2240,8 +2241,8 @@ this.fireEvent('actioncomplete',this,A);}else{if((typeof(A.result)!='undefined')
 }this.childForms.push(A);var n='';Roo.each(A.allItems,function(fe){n=typeof(fe.getName)=='undefined'?fe.name:fe.getName();if(this.findField(n)){return;}var B=new Roo.form.Hidden({name:n});B.render(this.el);this.add(B);},this);},markInvalid:function(A){if(A instanceof Array){for(var i=0,B=A.length;
 i<B;i++){var C=A[i];var f=this.findField(C.id);if(f){f.markInvalid(C.msg);}}}else{var D,id;for(id in A){if(typeof A[id]!='function'&&(D=this.findField(id))){D.markInvalid(A[id]);}}}Roo.each(this.childForms||[],function(f){f.markInvalid(A);});return this;}
 ,setValues:function(A){if(A instanceof Array){for(var i=0,B=A.length;i<B;i++){var v=A[i];var f=this.findField(v.id);if(f){f.setValue(v.value);if(this.trackResetOnLoad){f.originalValue=f.getValue();}}}}else{var C,id;for(id in A){if(typeof A[id]!='function'&&(C=this.findField(id))){if(C.setFromData&&C.valueField&&C.displayField&&(C.store&&!C.store.isLocal)){var sd={}
 }this.childForms.push(A);var n='';Roo.each(A.allItems,function(fe){n=typeof(fe.getName)=='undefined'?fe.name:fe.getName();if(this.findField(n)){return;}var B=new Roo.form.Hidden({name:n});B.render(this.el);this.add(B);},this);},markInvalid:function(A){if(A instanceof Array){for(var i=0,B=A.length;
 i<B;i++){var C=A[i];var f=this.findField(C.id);if(f){f.markInvalid(C.msg);}}}else{var D,id;for(id in A){if(typeof A[id]!='function'&&(D=this.findField(id))){D.markInvalid(A[id]);}}}Roo.each(this.childForms||[],function(f){f.markInvalid(A);});return this;}
 ,setValues:function(A){if(A instanceof Array){for(var i=0,B=A.length;i<B;i++){var v=A[i];var f=this.findField(v.id);if(f){f.setValue(v.value);if(this.trackResetOnLoad){f.originalValue=f.getValue();}}}}else{var C,id;for(id in A){if(typeof A[id]!='function'&&(C=this.findField(id))){if(C.setFromData&&C.valueField&&C.displayField&&(C.store&&!C.store.isLocal)){var sd={}
-;sd[C.valueField]=typeof(A[C.hiddenName])=='undefined'?'':A[C.hiddenName];sd[C.displayField]=typeof(A[C.name])=='undefined'?'':A[C.name];C.setFromData(sd);}else{C.setValue(A[id]);}if(this.trackResetOnLoad){C.originalValue=C.getValue();}}}}this.resetHasChanged();
-Roo.each(this.childForms||[],function(f){f.setValues(A);f.resetHasChanged();});return this;},getValues:function(A){if(this.childForms){Roo.each(this.childForms,function(f){this.setValues(f.getFieldValues());},this);}if(typeof(FormData)!='undefined'&&A!==true){try{var fd=(new FormData(this.el.dom)).entries();
+;sd[C.valueField]=typeof(A[C.hiddenName])=='undefined'?'':A[C.hiddenName];sd[C.displayField]=typeof(A[C.name])=='undefined'?'':A[C.name];C.setFromData(sd);}else if(C.inputType&&C.inputType=='radio'){C.setValue(A[id]);}else{C.setValue(A[id]);}if(this.trackResetOnLoad){C.originalValue=C.getValue();
+}}}}this.resetHasChanged();Roo.each(this.childForms||[],function(f){f.setValues(A);f.resetHasChanged();});return this;},getValues:function(A){if(this.childForms){Roo.each(this.childForms,function(f){this.setValues(f.getFieldValues());},this);}if(typeof(FormData)!='undefined'&&A!==true){try{var fd=(new FormData(this.el.dom)).entries();
 var B={};var C=fd.next();while(!C.done){B[C.value[0]]=C.value[1];C=fd.next();};return B;}catch(e){}}var fs=Roo.lib.Ajax.serializeForm(this.el.dom);if(A===true){return fs;}return Roo.urlDecode(fs);},getFieldValues:function(A){if(this.childForms){Roo.each(this.childForms,function(f){this.setValues(f.getFieldValues());
 },this);}var B={};this.items.each(function(f){if(f.readOnly&&A!==true){return;}if(!f.getName()){return;}var v=f.getValue();if(f.inputType=='radio'){if(typeof(B[f.getName()])=='undefined'){B[f.getName()]='';}if(!f.el.dom.checked){return;}v=f.el.dom.value;}
 if((typeof(v)=='object')&&f.getRawValue){v=f.getRawValue();}if(f.name!=f.getName()){B[f.name]=f.getRawValue();}B[f.getName()]=v;});return B;},clearInvalid:function(){this.items.each(function(f){f.clearInvalid();});Roo.each(this.childForms||[],function(f){f.clearInvalid();
 var B={};var C=fd.next();while(!C.done){B[C.value[0]]=C.value[1];C=fd.next();};return B;}catch(e){}}var fs=Roo.lib.Ajax.serializeForm(this.el.dom);if(A===true){return fs;}return Roo.urlDecode(fs);},getFieldValues:function(A){if(this.childForms){Roo.each(this.childForms,function(f){this.setValues(f.getFieldValues());
 },this);}var B={};this.items.each(function(f){if(f.readOnly&&A!==true){return;}if(!f.getName()){return;}var v=f.getValue();if(f.inputType=='radio'){if(typeof(B[f.getName()])=='undefined'){B[f.getName()]='';}if(!f.el.dom.checked){return;}v=f.el.dom.value;}
 if((typeof(v)=='object')&&f.getRawValue){v=f.getRawValue();}if(f.name!=f.getName()){B[f.name]=f.getRawValue();}B[f.getName()]=v;});return B;},clearInvalid:function(){this.items.each(function(f){f.clearInvalid();});Roo.each(this.childForms||[],function(f){f.clearInvalid();
index 0e683fb..29bfd4a 100644 (file)
@@ -45025,7 +45025,9 @@ Roo.extend(Roo.form.Checkbox, Roo.form.Field,  {
             this.fireEvent('check', this, state);
         }
         this.inSetChecked = true;
             this.fireEvent('check', this, state);
         }
         this.inSetChecked = true;
-        this.el.dom.value = state ? this.inputValue : this.valueOff;
+                
+               this.el.dom.value = state ? this.inputValue : this.valueOff;
+                
         this.inSetChecked = false;
         
     },
         this.inSetChecked = false;
         
     },
@@ -45116,9 +45118,49 @@ Roo.extend(Roo.form.Radio, Roo.form.Checkbox, {
             this.el.dom.checked =   'checked' ;
         }
          
             this.el.dom.checked =   'checked' ;
         }
          
+    },
+    /**
+     * Sets the checked state of the checkbox.
+     * On is always based on a string comparison between inputValue and the param.
+     * @param {Boolean/String} value - the value to set 
+     * @param {Boolean/String} suppressEvent - whether to suppress the checkchange event.
+     */
+    setValue : function(v,suppressEvent){
+        
+        
+        //this.checked = (v === true || v === 'true' || v == '1' || String(v).toLowerCase() == 'on');
+        //if(this.el && this.el.dom){
+        //    this.el.dom.checked = this.checked;
+        //    this.el.dom.defaultChecked = this.checked;
+        //}
+        this.setChecked(String(v) === String(this.inputValue), suppressEvent);
+        
+        this.el.dom.form[this.name].value = v;
+     
+        //this.fireEvent("check", this, this.checked);
+    },
+    // private..
+    setChecked : function(state,suppressEvent)
+    {
+         
+        if(this.wrap){
+            this.wrap[state ? 'addClass' : 'removeClass']('x-menu-item-checked');
+        }
+        this.checked = state;
+        if(suppressEvent !== true){
+            this.fireEvent('check', this, state);
+        }
+                
+                 
+       
+        
+    },
+    reset : function(){
+        // this.setValue(this.resetValue);
+        //this.originalValue = this.getValue();
+        this.clearInvalid();
     } 
     
     } 
     
-    
 });Roo.rtf = {}; // namespace
 Roo.rtf.Hex = function(hex)
 {
 });Roo.rtf = {}; // namespace
 Roo.rtf.Hex = function(hex)
 {
@@ -54290,6 +54332,9 @@ clientValidation  Boolean          Applies to submit only.  Pass true to call fo
             for(id in values){
                 if(typeof values[id] != 'function' && (field = this.findField(id))){
                     
             for(id in values){
                 if(typeof values[id] != 'function' && (field = this.findField(id))){
                     
+                    
+                    
+                    
                     if (field.setFromData && 
                         field.valueField && 
                         field.displayField &&
                     if (field.setFromData && 
                         field.valueField && 
                         field.displayField &&
@@ -54304,6 +54349,9 @@ clientValidation  Boolean          Applies to submit only.  Pass true to call fo
                         sd[field.displayField] = typeof(values[field.name]) == 'undefined' ? '' : values[field.name];
                         field.setFromData(sd);
                         
                         sd[field.displayField] = typeof(values[field.name]) == 'undefined' ? '' : values[field.name];
                         field.setFromData(sd);
                         
+                    } else if (field.inputType && field.inputType == 'radio') {
+                        
+                        field.setValue(values[id]);
                     } else {
                         field.setValue(values[id]);
                     }
                     } else {
                         field.setValue(values[id]);
                     }
@@ -54329,7 +54377,7 @@ clientValidation  Boolean          Applies to submit only.  Pass true to call fo
     /**
      * Returns the fields in this form as an object with key/value pairs. If multiple fields exist with the same name
      * they are returned as an array.
     /**
      * Returns the fields in this form as an object with key/value pairs. If multiple fields exist with the same name
      * they are returned as an array.
-     * @param {Boolean} asString
+     * @param {Boolean} asString (def)
      * @return {Object}
      */
     getValues : function(asString)
      * @return {Object}
      */
     getValues : function(asString)
index 94e89a3..8299201 100644 (file)
@@ -20526,7 +20526,9 @@ Roo.extend(Roo.form.Checkbox, Roo.form.Field,  {
             this.fireEvent('check', this, state);
         }
         this.inSetChecked = true;
             this.fireEvent('check', this, state);
         }
         this.inSetChecked = true;
-        this.el.dom.value = state ? this.inputValue : this.valueOff;
+                
+               this.el.dom.value = state ? this.inputValue : this.valueOff;
+                
         this.inSetChecked = false;
         
     },
         this.inSetChecked = false;
         
     },
@@ -20617,9 +20619,49 @@ Roo.extend(Roo.form.Radio, Roo.form.Checkbox, {
             this.el.dom.checked =   'checked' ;
         }
          
             this.el.dom.checked =   'checked' ;
         }
          
+    },
+    /**
+     * Sets the checked state of the checkbox.
+     * On is always based on a string comparison between inputValue and the param.
+     * @param {Boolean/String} value - the value to set 
+     * @param {Boolean/String} suppressEvent - whether to suppress the checkchange event.
+     */
+    setValue : function(v,suppressEvent){
+        
+        
+        //this.checked = (v === true || v === 'true' || v == '1' || String(v).toLowerCase() == 'on');
+        //if(this.el && this.el.dom){
+        //    this.el.dom.checked = this.checked;
+        //    this.el.dom.defaultChecked = this.checked;
+        //}
+        this.setChecked(String(v) === String(this.inputValue), suppressEvent);
+        
+        this.el.dom.form[this.name].value = v;
+     
+        //this.fireEvent("check", this, this.checked);
+    },
+    // private..
+    setChecked : function(state,suppressEvent)
+    {
+         
+        if(this.wrap){
+            this.wrap[state ? 'addClass' : 'removeClass']('x-menu-item-checked');
+        }
+        this.checked = state;
+        if(suppressEvent !== true){
+            this.fireEvent('check', this, state);
+        }
+                
+                 
+       
+        
+    },
+    reset : function(){
+        // this.setValue(this.resetValue);
+        //this.originalValue = this.getValue();
+        this.clearInvalid();
     } 
     
     } 
     
-    
 });Roo.rtf = {}; // namespace
 Roo.rtf.Hex = function(hex)
 {
 });Roo.rtf = {}; // namespace
 Roo.rtf.Hex = function(hex)
 {
@@ -29791,6 +29833,9 @@ clientValidation  Boolean          Applies to submit only.  Pass true to call fo
             for(id in values){
                 if(typeof values[id] != 'function' && (field = this.findField(id))){
                     
             for(id in values){
                 if(typeof values[id] != 'function' && (field = this.findField(id))){
                     
+                    
+                    
+                    
                     if (field.setFromData && 
                         field.valueField && 
                         field.displayField &&
                     if (field.setFromData && 
                         field.valueField && 
                         field.displayField &&
@@ -29805,6 +29850,9 @@ clientValidation  Boolean          Applies to submit only.  Pass true to call fo
                         sd[field.displayField] = typeof(values[field.name]) == 'undefined' ? '' : values[field.name];
                         field.setFromData(sd);
                         
                         sd[field.displayField] = typeof(values[field.name]) == 'undefined' ? '' : values[field.name];
                         field.setFromData(sd);
                         
+                    } else if (field.inputType && field.inputType == 'radio') {
+                        
+                        field.setValue(values[id]);
                     } else {
                         field.setValue(values[id]);
                     }
                     } else {
                         field.setValue(values[id]);
                     }
@@ -29830,7 +29878,7 @@ clientValidation  Boolean          Applies to submit only.  Pass true to call fo
     /**
      * Returns the fields in this form as an object with key/value pairs. If multiple fields exist with the same name
      * they are returned as an array.
     /**
      * Returns the fields in this form as an object with key/value pairs. If multiple fields exist with the same name
      * they are returned as an array.
-     * @param {Boolean} asString
+     * @param {Boolean} asString (def)
      * @return {Object}
      */
     getValues : function(asString)
      * @return {Object}
      */
     getValues : function(asString)
index d59a252..1fb6fed 100644 (file)
@@ -905,7 +905,8 @@ this.el.on('DOMAttrModified',this.setFromHidden,this);this.el.on('propertychange
 // Roo/form/Radio.js
 Roo.form.Radio=function(){Roo.form.Radio.superclass.constructor.apply(this,arguments);};Roo.extend(Roo.form.Radio,Roo.form.Checkbox,{inputType:'radio',getGroupValue:function(){return this.el.up('form').child('input[name='+this.el.dom.name+']:checked',true).value;
 },onRender:function(ct,A){Roo.form.Checkbox.superclass.onRender.call(this,ct,A);if(this.inputValue!==undefined){this.el.dom.value=this.inputValue;}this.wrap=this.el.wrap({cls:"x-form-check-wrap"});if(this.boxLabel){this.wrap.createChild({tag:'label',htmlFor:this.el.id,cls:'x-form-cb-label',html:this.boxLabel}
 // Roo/form/Radio.js
 Roo.form.Radio=function(){Roo.form.Radio.superclass.constructor.apply(this,arguments);};Roo.extend(Roo.form.Radio,Roo.form.Checkbox,{inputType:'radio',getGroupValue:function(){return this.el.up('form').child('input[name='+this.el.dom.name+']:checked',true).value;
 },onRender:function(ct,A){Roo.form.Checkbox.superclass.onRender.call(this,ct,A);if(this.inputValue!==undefined){this.el.dom.value=this.inputValue;}this.wrap=this.el.wrap({cls:"x-form-check-wrap"});if(this.boxLabel){this.wrap.createChild({tag:'label',htmlFor:this.el.id,cls:'x-form-cb-label',html:this.boxLabel}
-);}if(this.checked){this.el.dom.checked='checked';}}});
+);}if(this.checked){this.el.dom.checked='checked';}},setValue:function(v,A){this.setChecked(String(v)===String(this.inputValue),A);this.el.dom.form[this.name].value=v;},setChecked:function(A,B){if(this.wrap){this.wrap[A?'addClass':'removeClass']('x-menu-item-checked');
+}this.checked=A;if(B!==true){this.fireEvent('check',this,A);}},reset:function(){this.clearInvalid();}});
 // Roo/rtf/namespace.js
 Roo.rtf={};
 // Roo/rtf/Hex.js
 // Roo/rtf/namespace.js
 Roo.rtf={};
 // Roo/rtf/Hex.js
@@ -1293,8 +1294,8 @@ this.fireEvent('actioncomplete',this,A);}else{if((typeof(A.result)!='undefined')
 }this.childForms.push(A);var n='';Roo.each(A.allItems,function(fe){n=typeof(fe.getName)=='undefined'?fe.name:fe.getName();if(this.findField(n)){return;}var B=new Roo.form.Hidden({name:n});B.render(this.el);this.add(B);},this);},markInvalid:function(A){if(A instanceof Array){for(var i=0,B=A.length;
 i<B;i++){var C=A[i];var f=this.findField(C.id);if(f){f.markInvalid(C.msg);}}}else{var D,id;for(id in A){if(typeof A[id]!='function'&&(D=this.findField(id))){D.markInvalid(A[id]);}}}Roo.each(this.childForms||[],function(f){f.markInvalid(A);});return this;}
 ,setValues:function(A){if(A instanceof Array){for(var i=0,B=A.length;i<B;i++){var v=A[i];var f=this.findField(v.id);if(f){f.setValue(v.value);if(this.trackResetOnLoad){f.originalValue=f.getValue();}}}}else{var C,id;for(id in A){if(typeof A[id]!='function'&&(C=this.findField(id))){if(C.setFromData&&C.valueField&&C.displayField&&(C.store&&!C.store.isLocal)){var sd={}
 }this.childForms.push(A);var n='';Roo.each(A.allItems,function(fe){n=typeof(fe.getName)=='undefined'?fe.name:fe.getName();if(this.findField(n)){return;}var B=new Roo.form.Hidden({name:n});B.render(this.el);this.add(B);},this);},markInvalid:function(A){if(A instanceof Array){for(var i=0,B=A.length;
 i<B;i++){var C=A[i];var f=this.findField(C.id);if(f){f.markInvalid(C.msg);}}}else{var D,id;for(id in A){if(typeof A[id]!='function'&&(D=this.findField(id))){D.markInvalid(A[id]);}}}Roo.each(this.childForms||[],function(f){f.markInvalid(A);});return this;}
 ,setValues:function(A){if(A instanceof Array){for(var i=0,B=A.length;i<B;i++){var v=A[i];var f=this.findField(v.id);if(f){f.setValue(v.value);if(this.trackResetOnLoad){f.originalValue=f.getValue();}}}}else{var C,id;for(id in A){if(typeof A[id]!='function'&&(C=this.findField(id))){if(C.setFromData&&C.valueField&&C.displayField&&(C.store&&!C.store.isLocal)){var sd={}
-;sd[C.valueField]=typeof(A[C.hiddenName])=='undefined'?'':A[C.hiddenName];sd[C.displayField]=typeof(A[C.name])=='undefined'?'':A[C.name];C.setFromData(sd);}else{C.setValue(A[id]);}if(this.trackResetOnLoad){C.originalValue=C.getValue();}}}}this.resetHasChanged();
-Roo.each(this.childForms||[],function(f){f.setValues(A);f.resetHasChanged();});return this;},getValues:function(A){if(this.childForms){Roo.each(this.childForms,function(f){this.setValues(f.getFieldValues());},this);}if(typeof(FormData)!='undefined'&&A!==true){try{var fd=(new FormData(this.el.dom)).entries();
+;sd[C.valueField]=typeof(A[C.hiddenName])=='undefined'?'':A[C.hiddenName];sd[C.displayField]=typeof(A[C.name])=='undefined'?'':A[C.name];C.setFromData(sd);}else if(C.inputType&&C.inputType=='radio'){C.setValue(A[id]);}else{C.setValue(A[id]);}if(this.trackResetOnLoad){C.originalValue=C.getValue();
+}}}}this.resetHasChanged();Roo.each(this.childForms||[],function(f){f.setValues(A);f.resetHasChanged();});return this;},getValues:function(A){if(this.childForms){Roo.each(this.childForms,function(f){this.setValues(f.getFieldValues());},this);}if(typeof(FormData)!='undefined'&&A!==true){try{var fd=(new FormData(this.el.dom)).entries();
 var B={};var C=fd.next();while(!C.done){B[C.value[0]]=C.value[1];C=fd.next();};return B;}catch(e){}}var fs=Roo.lib.Ajax.serializeForm(this.el.dom);if(A===true){return fs;}return Roo.urlDecode(fs);},getFieldValues:function(A){if(this.childForms){Roo.each(this.childForms,function(f){this.setValues(f.getFieldValues());
 },this);}var B={};this.items.each(function(f){if(f.readOnly&&A!==true){return;}if(!f.getName()){return;}var v=f.getValue();if(f.inputType=='radio'){if(typeof(B[f.getName()])=='undefined'){B[f.getName()]='';}if(!f.el.dom.checked){return;}v=f.el.dom.value;}
 if((typeof(v)=='object')&&f.getRawValue){v=f.getRawValue();}if(f.name!=f.getName()){B[f.name]=f.getRawValue();}B[f.getName()]=v;});return B;},clearInvalid:function(){this.items.each(function(f){f.clearInvalid();});Roo.each(this.childForms||[],function(f){f.clearInvalid();
 var B={};var C=fd.next();while(!C.done){B[C.value[0]]=C.value[1];C=fd.next();};return B;}catch(e){}}var fs=Roo.lib.Ajax.serializeForm(this.el.dom);if(A===true){return fs;}return Roo.urlDecode(fs);},getFieldValues:function(A){if(this.childForms){Roo.each(this.childForms,function(f){this.setValues(f.getFieldValues());
 },this);}var B={};this.items.each(function(f){if(f.readOnly&&A!==true){return;}if(!f.getName()){return;}var v=f.getValue();if(f.inputType=='radio'){if(typeof(B[f.getName()])=='undefined'){B[f.getName()]='';}if(!f.el.dom.checked){return;}v=f.el.dom.value;}
 if((typeof(v)=='object')&&f.getRawValue){v=f.getRawValue();}if(f.name!=f.getName()){B[f.name]=f.getRawValue();}B[f.getName()]=v;});return B;},clearInvalid:function(){this.items.each(function(f){f.clearInvalid();});Roo.each(this.childForms||[],function(f){f.clearInvalid();