tag: 'input',
id : id,
type : this.inputType,
- value : this.inputType == 'radio' ? this.inputValue : ((!this.checked) ? this.valueOff : this.inputValue),
+ value : this.inputValue,
cls : 'roo-' + this.inputType, //'form-box',
placeholder : this.placeholder || ''
};
+
+ var hidden = {
+ tag: 'input',
+ type : 'hidden',
+ cls : 'roo-hidden-value',
+ value : this.checked ? this.valueOff : this.inputValue
+ };
+
if (this.weight) { // Validity check?
cfg.cls += " " + this.inputType + "-" + this.weight;
}
if(this.checked){
input.checked = this.checked;
+
}
+
if (this.name) {
- input.name = this.name;
+ hidden.name = this.name;
+ input.name = '_hidden_' + this.name;
}
if (this.size) {
}
});
- var inputblock = input;
+ var inputblock = {
+ tag: 'span',
+ cn : [
+ input,
+ hidden
+ ]
+ };
if (this.before || this.after) {
}
inputblock.cn.push(input);
+ inputblock.cn.push(hidden);
if (this.after) {
inputblock.cn.push({
{
return this.el.select('input.roo-' + this.inputType,true).first();
},
+ hiddenEl: function ()
+ {
+ return this.el.select('input.hidden-value',true).first();
+ },
labelEl: function()
{
this.inputEl().dom.checked = state;
- this.inputEl().dom.value = state ? this.inputValue : this.valueOff;
+
+ this.hiddenEl().dom.value = state ? this.inputValue : this.valueOff;
if(suppressEvent !== true){
this.fireEvent('check', this, state);
return this.getGroupValue();
}
- return this.inputEl().getValue();
+ return this.hiddenEl() ? this.hiddenEl().dom.value : this.value;
},
var _this = this;
- Roo.each(this.el.up('form').select('input[name='+this.name+']', true).elements, function(e){
- this.getActionEl().addClass(this.disabledClass);
- this.el.dom.disabled = true;
-
- e.findParent('.form-group', false, true).removeClass([_this.invalidClass, _this.validClass]);
- e.findParent('.form-group', false, true).addClass(_this.invalidClass);
- });
+ if(this.rendered){
+ Roo.each(this.el.up('form').select('input[name='+this.name+']', true).elements, function(e){
+ _this.getActionEl().addClass(this.disabledClass);
+ e.dom.disabled = true;
+ });
+ }
this.disabled = true;
this.fireEvent("disable", this);
enable : function()
{
+ if(this.inputType != 'radio'){
+ Roo.bootstrap.CheckBox.superclass.enable.call(this);
+ return;
+ }
+
+ var _this = this;
+
if(this.rendered){
- this.onEnable();
+ Roo.each(this.el.up('form').select('input[name='+this.name+']', true).elements, function(e){
+ _this.getActionEl().removeClass(this.disabledClass);
+ e.dom.disabled = false;
+ });
}
+
this.disabled = false;
this.fireEvent("enable", this);
return this;
}
+
});