9 * @class Roo.bootstrap.FieldLabel
10 * @extends Roo.bootstrap.Component
11 * Bootstrap FieldLabel class
12 * @cfg {String} html contents of the element
13 * @cfg {String} tag tag of the element default label
14 * @cfg {String} cls class of the element
15 * @cfg {String} for label target
18 * Create a new FieldLabel
19 * @param {Object} config The config object
22 Roo.bootstrap.FieldLabel = function(config){
23 Roo.bootstrap.Element.superclass.constructor.call(this, config);
28 * Fires after the field has been marked as invalid.
29 * @param {Roo.form.FieldLabel} this
30 * @param {String} msg The validation message
35 * Fires after the field has been validated with no errors.
36 * @param {Roo.form.FieldLabel} this
42 Roo.extend(Roo.bootstrap.FieldLabel, Roo.bootstrap.Component, {
49 getAutoCreate : function(){
65 initEvents: function()
67 Roo.bootstrap.Element.superclass.initEvents.call(this);
72 * Mark this field as valid
74 markValid : function(){
75 if(!this.el || this.preventMark){ // not rendered
79 this.el.removeClass([this.invalidClass, this.validClass]);
81 var feedback = this.el.select('.form-control-feedback', true).first();
84 this.el.select('.form-control-feedback', true).first().removeClass([this.invalidFeedbackClass, this.validFeedbackClass]);
87 if(this.disabled || this.allowBlank){
91 this.el.addClass(this.validClass);
93 if(this.hasFeedback && this.inputType != 'hidden' && !this.allowBlank && (this.getValue().length || this.forceFeedback)){
95 var feedback = this.el.select('.form-control-feedback', true).first();
98 this.el.select('.form-control-feedback', true).first().removeClass([this.invalidFeedbackClass, this.validFeedbackClass]);
99 this.el.select('.form-control-feedback', true).first().addClass([this.validFeedbackClass]);
104 this.fireEvent('valid', this);
108 * Mark this field as invalid
109 * @param {String} msg The validation message
111 markInvalid : function(msg)
113 if(!this.el || this.preventMark){ // not rendered
117 this.el.removeClass([this.invalidClass, this.validClass]);
119 var feedback = this.el.select('.form-control-feedback', true).first();
122 this.el.select('.form-control-feedback', true).first().removeClass([this.invalidFeedbackClass, this.validFeedbackClass]);
125 if(this.disabled || this.allowBlank){
129 this.el.addClass(this.invalidClass);
131 if(this.hasFeedback && this.inputType != 'hidden' && !this.allowBlank){
133 var feedback = this.el.select('.form-control-feedback', true).first();
136 this.el.select('.form-control-feedback', true).first().removeClass([this.invalidFeedbackClass, this.validFeedbackClass]);
138 if(this.getValue().length || this.forceFeedback){
139 this.el.select('.form-control-feedback', true).first().addClass([this.invalidFeedbackClass]);
146 this.fireEvent('invalid', this, msg);