Roo.bootstrap.form.TextArea = function(config){
Roo.bootstrap.form.TextArea.superclass.constructor.call(this, config);
};
Roo.extend(Roo.bootstrap.form.TextArea, Roo.bootstrap.form.Input, {
cols : false,
rows : 5,
readOnly : false,
warp : 'soft',
resize : false,
value: false,
html: false,
getAutoCreate : function(){
var align = (!this.labelAlign) ? this.parentLabelAlign() : this.labelAlign;
var id = Roo.id();
var cfg = {};
if(this.inputType != 'hidden'){
cfg.cls = 'form-group' }
var input = {
tag: 'textarea',
id : id,
warp : this.warp,
rows : this.rows,
value : this.value || '',
html: this.html || '',
cls : 'form-control',
placeholder : this.placeholder || ''
};
if(this.maxLength && this.maxLength != Number.MAX_VALUE){
input.maxLength = this.maxLength;
}
if(this.resize){
input.style = (typeof(input.style) == 'undefined') ? 'resize:' + this.resize : input.style + 'resize:' + this.resize;
}
if(this.cols){
input.cols = this.cols;
}
if (this.readOnly) {
input.readonly = true;
}
if (this.name) {
input.name = this.name;
}
if (this.size) {
input.cls = (typeof(input.cls) == 'undefined') ? 'input-' + this.size : input.cls + ' input-' + this.size;
}
var settings=this;
['xs','sm','md','lg'].map(function(size){
if (settings[size]) {
cfg.cls += ' col-' + size + '-' + settings[size];
}
});
var inputblock = input;
if(this.hasFeedback){
var feedback = {
tag: 'span',
cls: 'glyphicon form-control-feedback'
};
inputblock = {
cls : 'has-feedback',
cn : [
input,
feedback
]
};
}
if (this.before || this.after) {
inputblock = {
cls : 'input-group',
cn : []
};
if (this.before) {
inputblock.cn.push({
tag :'span',
cls : 'input-group-addon',
html : this.before
});
}
inputblock.cn.push(input);
if(this.hasFeedback){
inputblock.cls += ' has-feedback';
inputblock.cn.push(feedback);
}
if (this.after) {
inputblock.cn.push({
tag :'span',
cls : 'input-group-addon',
html : this.after
});
}
}
cfg = this.getAutoCreateLabel( cfg, inputblock );
if (this.disabled) {
input.disabled=true;
}
return cfg;
},
inputEl: function ()
{
return this.el.select('textarea.form-control',true).first();
},
clearInvalid : function()
{
if(!this.el || this.preventMark){ return;
}
var label = this.el.select('label', true).first();
this.el.removeClass( this.validClass);
this.inputEl().removeClass('is-invalid');
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('');
feedback.hide();
}
}
this.fireEvent('valid', this);
},
markValid : function()
{
if(!this.el || this.preventMark){ return;
}
this.el.removeClass([this.invalidClass, this.validClass]);
this.inputEl().removeClass(['is-valid', 'is-invalid']);
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('');
feedback.hide();
}
if(this.disabled || this.allowBlank){
return;
}
var label = this.el.select('label', true).first();
var icon = this.el.select('i.fa-star', true).first();
if (Roo.bootstrap.version == 3) {
this.el.addClass(this.validClass);
} else {
this.inputEl().addClass('is-valid');
}
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]);
this.el.select('.form-control-feedback', true).first().addClass([this.validFeedbackClass]);
}
}
this.fireEvent('valid', this);
},
markInvalid : function(msg)
{
if(!this.el || this.preventMark){ return;
}
this.el.removeClass([this.invalidClass, this.validClass]);
this.inputEl().removeClass(['is-valid', 'is-invalid']);
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('');
feedback.hide();
}
if(this.disabled){
return;
}
var label = this.el.select('label', true).first();
if (Roo.bootstrap.version == 3) {
this.el.addClass(this.invalidClass);
} else {
this.inputEl().addClass('is-invalid');
}
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]);
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);
}
if(feedback.dom.innerHTML) {
feedback.show();
}
}
}
this.fireEvent('invalid', this, msg);
}
});