* @cfg {Boolean} checked initnal the element
* @cfg {Boolean} inline inline the element (default false)
* @cfg {String} groupId the checkbox group id // normal just use for checkbox
+ * @cfg {String} tooltip label tooltip
*
* @constructor
* Create a new CheckBox
* @param {Roo.bootstrap.CheckBox} this This input
* @param {Boolean} checked The new checked value
*/
- check : true
+ check : true,
+ /**
+ * @event click
+ * Fires when the element is click.
+ * @param {Roo.bootstrap.CheckBox} this This input
+ */
+ click : true
});
};
checked: false,
weight : false,
inline: false,
+ tooltip : '',
getAutoCreate : function()
{
tag: 'input',
type : 'hidden',
cls : 'roo-hidden-value',
- value : this.checked ? this.valueOff : this.inputValue
+ value : this.checked ? this.inputValue : this.valueOff
};
}
if(this.checked){
input.checked = this.checked;
-
}
-
if (this.name) {
input.name = this.name;
'for' : id,
cls : 'control-label',
html : this.fieldLabel
-
},
{
cls : "",
cls: 'control-label box-input-label',
//cls : 'input-group-addon',
html : this.fieldLabel
-
},
inputblock
html: this.boxLabel
};
+ if(this.useFontAwesomeCheckBox) {
+ boxLabelCfg.cls = 'box-label fa-checkbox'
+ }
+
if(this.tooltip){
boxLabelCfg.tooltip = this.tooltip;
}
}
},
- onClick : function()
+ onClick : function(e)
{
- this.setChecked(!this.checked);
+ if(this.fireEvent('click', this, e) !== false){
+ this.setChecked(!this.checked);
+ }
+
},
setChecked : function(state,suppressEvent)
validate : function()
{
+ if(this.getVisibilityEl().hasClass('hidden')){
+ return true;
+ }
+
if(
this.disabled ||
(this.inputType == 'radio' && this.validateRadio()) ||
(this.inputType == 'checkbox' && this.validateCheckbox())
){
- Roo.log('marking valid: '+this.name);
this.markValid();
return true;
}
validateRadio : function()
{
+ if(this.getVisibilityEl().hasClass('hidden')){
+ return true;
+ }
+
if(this.allowBlank){
return true;
}
{
if(!this.groupId){
return (this.getValue() == this.inputValue || this.allowBlank) ? true : false;
+ //return (this.getValue() == this.inputValue) ? true : false;
}
var group = Roo.bootstrap.CheckBox.get(this.groupId);
var r = false;
+ for(var i in group){
+ if(group[i].el.isVisible(true)){
+ r = false;
+ break;
+ }
+
+ r = true;
+ }
+
for(var i in group){
if(r){
break;
return;
}
-
+
if(!this.groupId){
this.el.findParent('.form-group', false, true).removeClass([this.invalidClass, this.validClass]);
this.el.findParent('.form-group', false, true).addClass(this.validClass);
{
Roo.bootstrap.Input.prototype.clearInvalid.call(this);
+ // this.el.findParent('.form-group', false, true).removeClass([this.invalidClass, this.validClass]);
+
var label = Roo.bootstrap.FieldLabel.get(this.name + '-group');
- if (label) {
+ if (label && label.iconEl) {
label.iconEl.removeClass(label.validClass);
label.iconEl.removeClass(label.invalidClass);
}
this.disabled = false;
this.fireEvent("enable", this);
return this;
+ },
+
+ setBoxLabel : function(v)
+ {
+ this.boxLabel = v;
+
+ if(this.rendered){
+ this.el.select('label.box-label',true).first().dom.innerHTML = (v === null || v === undefined ? '' : v);
+ }
}
});