getAutoCreate : function()
{
- var align = (!this.labelAlign) ? this.parentLabelAlign() : this.labelAlign;
var id = Roo.id();
cls: 'glyphicon form-control-feedback'
};
- if(this.hasFeedback && this.inputType != 'hidden' && !this.allowBlank){
+ if(this.hasFeedback && this.inputType != 'hidden'){
inputblock = {
cls : 'has-feedback',
});
}
- if(this.hasFeedback && this.inputType != 'hidden' && !this.allowBlank){
+ if(this.hasFeedback && this.inputType != 'hidden'){
inputblock.cls += ' has-feedback';
inputblock.cn.push(feedback);
}
};
+
+
+
+ cfg = this.getAutoCreateLabel( cfg, inputblock );
+
+
+
+
+ if (this.parentType === 'Navbar' && this.parent().bar) {
+ cfg.cls += ' navbar-form';
+ }
+
+ if (this.parentType === 'NavGroup' && !(Roo.bootstrap.version == 4 && this.parent().form)) {
+ // on BS4 we do this only if not form
+ cfg.cls += ' navbar-form';
+ cfg.tag = 'li';
+ }
+
+ return cfg;
+
+ },
+ /**
+ * autocreate the label - also used by textara... ?? and others?
+ */
+ getAutoCreateLabel : function( cfg, inputblock )
+ {
+ var align = (!this.labelAlign) ? this.parentLabelAlign() : this.labelAlign;
+
var indicator = {
tag : 'i',
cls : 'roo-required-indicator ' + (this.indicatorpos == 'right' ? 'right' : 'left') +'-indicator text-danger fa fa-lg fa-star',
};
-
- if (this.parentType === 'Navbar' && this.parent().bar) {
- cfg.cls += ' navbar-form';
- }
-
- if (this.parentType === 'NavGroup' && !(Roo.bootstrap.version == 4 && this.parent().form)) {
- // on BS4 we do this only if not form
- cfg.cls += ' navbar-form';
- cfg.tag = 'li';
- }
-
return cfg;
-
},
+
+
/**
* return the real input element.
*/
*/
reset : function(){
this.setValue(this.originalValue);
- this.validate();
+ // this.validate();
+ this.el.removeClass([this.invalidClass, this.validClass]);
+ this.inputEl().removeClass(['is-valid', 'is-invalid']);
},
/**
* Returns the name of the field
* @return {Mixed} value The field value
*/
getValue : function(){
-
var v = this.inputEl().getValue();
-
return v;
},
/**
this.el.removeClass([this.invalidClass, 'is-invalid']);
- if(this.hasFeedback && this.inputType != 'hidden' && !this.allowBlank){
+ if(this.hasFeedback && this.inputType != 'hidden'){
var feedback = this.el.select('.form-control-feedback', true).first();
if(feedback){
this.el.select('.form-control-feedback', true).first().removeClass(this.invalidFeedbackClass);
+
+ feedback.update('');
}
}
* Mark this field as valid
*/
markValid : function()
- {
+ {
if(!this.el || this.preventMark){ // not rendered...
return;
}
if(feedback){
this.el.select('.form-control-feedback', true).first().removeClass([this.invalidFeedbackClass, this.validFeedbackClass]);
+ feedback.update('');
}
if(this.indicator){
this.inputEl().addClass('is-valid');
}
- if(this.hasFeedback && this.inputType != 'hidden' && !this.allowBlank && (this.getValue().length || this.forceFeedback)){
+ if(this.hasFeedback && this.inputType != 'hidden'){
var feedback = this.el.select('.form-control-feedback', true).first();
if(feedback){
this.el.select('.form-control-feedback', true).first().removeClass(
[this.invalidFeedbackClass, this.validFeedbackClass]);
+ feedback.update('');
}
if(this.disabled){
- if(this.hasFeedback && this.inputType != 'hidden' && !this.allowBlank){
+ if(this.hasFeedback && this.inputType != 'hidden'){
var feedback = this.el.select('.form-control-feedback', true).first();
if(feedback){
this.el.select('.form-control-feedback', true).first().removeClass([this.invalidFeedbackClass, this.validFeedbackClass]);
- if(this.getValue().length || this.forceFeedback){
- this.el.select('.form-control-feedback', true).first().addClass([this.invalidFeedbackClass]);
+ this.el.select('.form-control-feedback', true).first().addClass([this.invalidFeedbackClass]);
+
+ feedback.update(this.invalidText);
+
+ if(!this.allowBlank && !this.getRawValue().length){
+ feedback.update(this.blankText);
}
}