Fix #7418 - radio button set value
[roojs1] / Roo / form / Checkbox.js
index ef3d3e7..634c510 100644 (file)
@@ -146,6 +146,9 @@ Roo.extend(Roo.form.Checkbox, Roo.form.Field,  {
 
        // private
     onClick : function(){ 
+        if (this.disabled) {
+            return;
+        }
         this.setChecked(!this.checked);
 
         //if(this.el.dom.checked != this.checked){
@@ -155,15 +158,19 @@ Roo.extend(Roo.form.Checkbox, Roo.form.Field,  {
 
     /**
      * Sets the checked state of the checkbox.
-     * @param {Boolean/String} checked True, 'true', '1', or 'on' to check the checkbox, any other value will uncheck it.
+     * 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(v === this.inputValue);
+        this.setChecked(String(v) === String(this.inputValue), suppressEvent);
         //this.fireEvent("check", this, this.checked);
     },
     // private..
@@ -180,10 +187,12 @@ Roo.extend(Roo.form.Checkbox, Roo.form.Field,  {
         }
         this.checked = state;
         if(suppressEvent !== true){
-            this.fireEvent('checkchange', this, state);
+            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;
         
     },
@@ -205,6 +214,11 @@ Roo.extend(Roo.form.Checkbox, Roo.form.Field,  {
         }
          
         Roo.form.Checkbox.superclass.onDestroy.call(this);
+    },
+    
+    setBoxLabel : function(str)
+    {
+        this.wrap.select('.x-form-cb-label', true).first().dom.innerHTML = str;
     }
 
 });
\ No newline at end of file