From 33c98bf5608e7ec6cfe2031f9f4141dff6c2231c Mon Sep 17 00:00:00 2001 From: Alan Date: Mon, 24 Apr 2023 13:19:09 +0800 Subject: [PATCH] fix #7616 - invalid field changes --- Roo/bootstrap/form/Input.js | 24 ++++++++++++------ Roo/bootstrap/form/TextArea.js | 22 ++++++++++------ roojs-bootstrap-debug.js | 46 +++++++++++++++++++++++----------- roojs-bootstrap.js | 37 +++++++++++++-------------- 4 files changed, 80 insertions(+), 49 deletions(-) diff --git a/Roo/bootstrap/form/Input.js b/Roo/bootstrap/form/Input.js index 669d55d942..a0b2051132 100644 --- a/Roo/bootstrap/form/Input.js +++ b/Roo/bootstrap/form/Input.js @@ -341,7 +341,7 @@ Roo.extend(Roo.bootstrap.form.Input, Roo.bootstrap.Component, { cls: 'glyphicon form-control-feedback' }; - if(this.hasFeedback && this.inputType != 'hidden' && !this.allowBlank){ + if(this.hasFeedback && this.inputType != 'hidden'){ inputblock = { cls : 'has-feedback', @@ -396,7 +396,7 @@ Roo.extend(Roo.bootstrap.form.Input, Roo.bootstrap.Component, { }); } - if(this.hasFeedback && this.inputType != 'hidden' && !this.allowBlank){ + if(this.hasFeedback && this.inputType != 'hidden'){ inputblock.cls += ' has-feedback'; inputblock.cn.push(feedback); } @@ -910,12 +910,14 @@ Roo.extend(Roo.bootstrap.form.Input, Roo.bootstrap.Component, { 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(''); } } @@ -932,7 +934,7 @@ Roo.extend(Roo.bootstrap.form.Input, Roo.bootstrap.Component, { * Mark this field as valid */ markValid : function() - { + { if(!this.el || this.preventMark){ // not rendered... return; } @@ -944,6 +946,7 @@ Roo.extend(Roo.bootstrap.form.Input, Roo.bootstrap.Component, { if(feedback){ this.el.select('.form-control-feedback', true).first().removeClass([this.invalidFeedbackClass, this.validFeedbackClass]); + feedback.update(''); } if(this.indicator){ @@ -965,7 +968,7 @@ Roo.extend(Roo.bootstrap.form.Input, Roo.bootstrap.Component, { 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(); @@ -997,6 +1000,7 @@ Roo.extend(Roo.bootstrap.form.Input, Roo.bootstrap.Component, { if(feedback){ this.el.select('.form-control-feedback', true).first().removeClass( [this.invalidFeedbackClass, this.validFeedbackClass]); + feedback.update(''); } if(this.disabled){ @@ -1019,15 +1023,19 @@ Roo.extend(Roo.bootstrap.form.Input, Roo.bootstrap.Component, { - 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); } } diff --git a/Roo/bootstrap/form/TextArea.js b/Roo/bootstrap/form/TextArea.js index 7c2138bd26..8381df9cbd 100644 --- a/Roo/bootstrap/form/TextArea.js +++ b/Roo/bootstrap/form/TextArea.js @@ -92,7 +92,7 @@ Roo.extend(Roo.bootstrap.form.TextArea, Roo.bootstrap.form.Input, { var inputblock = input; - if(this.hasFeedback && !this.allowBlank){ + if(this.hasFeedback){ var feedback = { tag: 'span', @@ -125,7 +125,7 @@ Roo.extend(Roo.bootstrap.form.TextArea, Roo.bootstrap.form.Input, { inputblock.cn.push(input); - if(this.hasFeedback && !this.allowBlank){ + if(this.hasFeedback){ inputblock.cls += ' has-feedback'; inputblock.cn.push(feedback); } @@ -179,12 +179,14 @@ Roo.extend(Roo.bootstrap.form.TextArea, Roo.bootstrap.form.Input, { this.el.removeClass( this.validClass); this.inputEl().removeClass('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(''); } } @@ -208,6 +210,7 @@ Roo.extend(Roo.bootstrap.form.TextArea, Roo.bootstrap.form.Input, { if(feedback){ this.el.select('.form-control-feedback', true).first().removeClass([this.invalidFeedbackClass, this.validFeedbackClass]); + feedback.update(''); } if(this.disabled || this.allowBlank){ @@ -227,7 +230,7 @@ Roo.extend(Roo.bootstrap.form.TextArea, Roo.bootstrap.form.Input, { } - 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(); @@ -258,6 +261,7 @@ Roo.extend(Roo.bootstrap.form.TextArea, Roo.bootstrap.form.Input, { if(feedback){ this.el.select('.form-control-feedback', true).first().removeClass([this.invalidFeedbackClass, this.validFeedbackClass]); + feedback.update(''); } if(this.disabled){ @@ -284,15 +288,19 @@ Roo.extend(Roo.bootstrap.form.TextArea, Roo.bootstrap.form.Input, { } // fixme ... this may be depricated need to test.. - 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); } } diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index d4a728c2dc..84470c0c4e 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -12614,7 +12614,7 @@ Roo.extend(Roo.bootstrap.form.Input, Roo.bootstrap.Component, { cls: 'glyphicon form-control-feedback' }; - if(this.hasFeedback && this.inputType != 'hidden' && !this.allowBlank){ + if(this.hasFeedback && this.inputType != 'hidden'){ inputblock = { cls : 'has-feedback', @@ -12669,7 +12669,7 @@ Roo.extend(Roo.bootstrap.form.Input, Roo.bootstrap.Component, { }); } - if(this.hasFeedback && this.inputType != 'hidden' && !this.allowBlank){ + if(this.hasFeedback && this.inputType != 'hidden'){ inputblock.cls += ' has-feedback'; inputblock.cn.push(feedback); } @@ -13183,12 +13183,14 @@ Roo.extend(Roo.bootstrap.form.Input, Roo.bootstrap.Component, { 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(''); } } @@ -13205,7 +13207,7 @@ Roo.extend(Roo.bootstrap.form.Input, Roo.bootstrap.Component, { * Mark this field as valid */ markValid : function() - { + { if(!this.el || this.preventMark){ // not rendered... return; } @@ -13217,6 +13219,7 @@ Roo.extend(Roo.bootstrap.form.Input, Roo.bootstrap.Component, { if(feedback){ this.el.select('.form-control-feedback', true).first().removeClass([this.invalidFeedbackClass, this.validFeedbackClass]); + feedback.update(''); } if(this.indicator){ @@ -13238,7 +13241,7 @@ Roo.extend(Roo.bootstrap.form.Input, Roo.bootstrap.Component, { 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(); @@ -13270,6 +13273,7 @@ Roo.extend(Roo.bootstrap.form.Input, Roo.bootstrap.Component, { if(feedback){ this.el.select('.form-control-feedback', true).first().removeClass( [this.invalidFeedbackClass, this.validFeedbackClass]); + feedback.update(''); } if(this.disabled){ @@ -13292,15 +13296,19 @@ Roo.extend(Roo.bootstrap.form.Input, Roo.bootstrap.Component, { - 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); } } @@ -13489,7 +13497,7 @@ Roo.extend(Roo.bootstrap.form.TextArea, Roo.bootstrap.form.Input, { var inputblock = input; - if(this.hasFeedback && !this.allowBlank){ + if(this.hasFeedback){ var feedback = { tag: 'span', @@ -13522,7 +13530,7 @@ Roo.extend(Roo.bootstrap.form.TextArea, Roo.bootstrap.form.Input, { inputblock.cn.push(input); - if(this.hasFeedback && !this.allowBlank){ + if(this.hasFeedback){ inputblock.cls += ' has-feedback'; inputblock.cn.push(feedback); } @@ -13576,12 +13584,14 @@ Roo.extend(Roo.bootstrap.form.TextArea, Roo.bootstrap.form.Input, { this.el.removeClass( this.validClass); this.inputEl().removeClass('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(''); } } @@ -13605,6 +13615,7 @@ Roo.extend(Roo.bootstrap.form.TextArea, Roo.bootstrap.form.Input, { if(feedback){ this.el.select('.form-control-feedback', true).first().removeClass([this.invalidFeedbackClass, this.validFeedbackClass]); + feedback.update(''); } if(this.disabled || this.allowBlank){ @@ -13624,7 +13635,7 @@ Roo.extend(Roo.bootstrap.form.TextArea, Roo.bootstrap.form.Input, { } - 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(); @@ -13655,6 +13666,7 @@ Roo.extend(Roo.bootstrap.form.TextArea, Roo.bootstrap.form.Input, { if(feedback){ this.el.select('.form-control-feedback', true).first().removeClass([this.invalidFeedbackClass, this.validFeedbackClass]); + feedback.update(''); } if(this.disabled){ @@ -13681,15 +13693,19 @@ Roo.extend(Roo.bootstrap.form.TextArea, Roo.bootstrap.form.Input, { } // fixme ... this may be depricated need to test.. - 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); } } diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index d634c56295..5ed7650e11 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -533,9 +533,9 @@ Roo.bootstrap.form.Input=function(A){Roo.bootstrap.form.Input.superclass.constru while(A.parent()){A=A.parent();if(typeof(A.labelAlign)!='undefined'){return A.labelAlign;}}return 'left';},getAutoCreate:function(){var id=Roo.id();var A={};if(this.inputType!='hidden'){A.cls='form-group'}var B={tag:'input',id:id,type:this.inputType,value:this.value,cls:'form-control',placeholder:this.placeholder||'',autocomplete:this.autocomplete||'new-password'} ;if(this.inputType=='file'){B.style='overflow:hidden';}if(this.capture.length){B.capture=this.capture;}if(this.accept.length){B.accept=this.accept+"/*";}if(this.align){B.style=(typeof(B.style)=='undefined')?('text-align:'+this.align):(B.style+'text-align:'+this.align); }if(this.maxLength&&this.maxLength!=Number.MAX_VALUE){B.maxLength=this.maxLength;}if(this.disabled){B.disabled=true;}if(this.readOnly){B.readonly=true;}if(this.name){B.name=this.name;}if(this.size){B.cls+=' input-'+this.size;}var C=this;['xs','sm','md','lg'].map(function(F){if(C[F]){A.cls+=' col-'+F+'-'+C[F]; -}});var D=B;var E={tag:'span',cls:'glyphicon form-control-feedback'};if(this.hasFeedback&&this.inputType!='hidden'&&!this.allowBlank){D={cls:'has-feedback',cn:[B,E]};}if(this.before||this.after){D={cls:'input-group',cn:[]};if(this.before&&typeof(this.before)=='string'){D.cn.push({tag:'span',cls:'roo-input-before input-group-addon input-group-prepend input-group-text',html:this.before} +}});var D=B;var E={tag:'span',cls:'glyphicon form-control-feedback'};if(this.hasFeedback&&this.inputType!='hidden'){D={cls:'has-feedback',cn:[B,E]};}if(this.before||this.after){D={cls:'input-group',cn:[]};if(this.before&&typeof(this.before)=='string'){D.cn.push({tag:'span',cls:'roo-input-before input-group-addon input-group-prepend input-group-text',html:this.before} );}if(this.before&&typeof(this.before)=='object'){this.before=Roo.factory(this.before);D.cn.push({tag:'span',cls:'roo-input-before input-group-prepend input-group-'+(this.before.xtype=='Button'?'btn':'addon')});}D.cn.push(B);if(this.after&&typeof(this.after)=='string'){D.cn.push({tag:'span',cls:'roo-input-after input-group-append input-group-text input-group-addon',html:this.after} -);}if(this.after&&typeof(this.after)=='object'){this.after=Roo.factory(this.after);D.cn.push({tag:'span',cls:'roo-input-after input-group-append input-group-'+(this.after.xtype=='Button'?'btn':'addon')});}if(this.hasFeedback&&this.inputType!='hidden'&&!this.allowBlank){D.cls+=' has-feedback'; +);}if(this.after&&typeof(this.after)=='object'){this.after=Roo.factory(this.after);D.cn.push({tag:'span',cls:'roo-input-after input-group-append input-group-'+(this.after.xtype=='Button'?'btn':'addon')});}if(this.hasFeedback&&this.inputType!='hidden'){D.cls+=' has-feedback'; D.cn.push(E);}};A=this.getAutoCreateLabel(A,D);if(this.parentType==='Navbar'&&this.parent().bar){A.cls+=' navbar-form';}if(this.parentType==='NavGroup'&&!(Roo.bootstrap.version==4&&this.parent().form)){A.cls+=' navbar-form';A.tag='li';}return A;},getAutoCreateLabel:function(A,B){var C=(!this.labelAlign)?this.parentLabelAlign():this.labelAlign; var D={tag:'i',cls:'roo-required-indicator '+(this.indicatorpos=='right'?'right':'left')+'-indicator text-danger fa fa-lg fa-star',tooltip:'This field is required'};if(this.allowBlank){D.style=this.allowBlank?' display:none':'';}if(C==='left'&&this.fieldLabel.length){A.cls+=' roo-form-group-label-left'+(Roo.bootstrap.version==4?' row':''); A.cn=[D,{tag:'label','for':id,cls:'control-label col-form-label',html:this.fieldLabel},{cls:"",cn:[B]}];var E=A.cn[1];var F=A.cn[2];if(this.indicatorpos=='right'){A.cn=[{tag:'label','for':id,cls:'control-label col-form-label',cn:[{tag:'span',html:this.fieldLabel} @@ -558,15 +558,15 @@ if(!this.hasFocus){this.hasFocus=true;this.startValue=this.getValue();this.fireE return v;},getRawValue:function(){var v=this.inputEl().getValue();return v;},setRawValue:function(v){return this.inputEl().dom.value=(v===null||v===undefined?'':v);},selectText:function(A,B){var v=this.getRawValue();if(v.length>0){A=A===undefined?0:A;B=B===undefined?v.length:B; var d=this.inputEl().dom;if(d.setSelectionRange){d.setSelectionRange(A,B);}else if(d.createTextRange){var C=d.createTextRange();C.moveStart("character",A);C.moveEnd("character",v.length-B);C.select();}}},setValue:function(v){this.value=v;if(this.rendered){this.inputEl().dom.value=(v===null||v===undefined?'':v); this.validate();}},preFocus:function(){if(this.selectOnFocus){this.inputEl().dom.select();}},filterKeys:function(e){var k=e.getKey();if(!Roo.isIE&&(e.isNavKeyPress()||k==e.BACKSPACE||(k==e.DELETE&&e.button==-1))){return;}var c=e.getCharCode(),cc=String.fromCharCode(c); -if(Roo.isIE&&(e.isSpecialKey()||!cc)){return;}if(!this.maskRe.test(cc)){e.stopEvent();}},clearInvalid:function(){if(!this.el||this.preventMark){return;}this.el.removeClass([this.invalidClass,'is-invalid']);if(this.hasFeedback&&this.inputType!='hidden'&&!this.allowBlank){var A=this.el.select('.form-control-feedback',true).first(); -if(A){this.el.select('.form-control-feedback',true).first().removeClass(this.invalidFeedbackClass);}}if(this.indicator){this.indicator.removeClass('visible');this.indicator.addClass(this.indicatorpos=='right'?'hidden':'invisible');}this.fireEvent('valid',this); +if(Roo.isIE&&(e.isSpecialKey()||!cc)){return;}if(!this.maskRe.test(cc)){e.stopEvent();}},clearInvalid:function(){if(!this.el||this.preventMark){return;}this.el.removeClass([this.invalidClass,'is-invalid']);if(this.hasFeedback&&this.inputType!='hidden'){var A=this.el.select('.form-control-feedback',true).first(); +if(A){this.el.select('.form-control-feedback',true).first().removeClass(this.invalidFeedbackClass);A.update('');}}if(this.indicator){this.indicator.removeClass('visible');this.indicator.addClass(this.indicatorpos=='right'?'hidden':'invisible');}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 A=this.el.select('.form-control-feedback',true).first();if(A){this.el.select('.form-control-feedback',true).first().removeClass([this.invalidFeedbackClass,this.validFeedbackClass]); -}if(this.indicator){this.indicator.removeClass('visible');this.indicator.addClass(this.indicatorpos=='right'?'hidden':'invisible');}if(this.disabled){return;}if(this.allowBlank&&!this.getRawValue().length){return;}if(Roo.bootstrap.version==3){this.el.addClass(this.validClass); -}else{this.inputEl().addClass('is-valid');}if(this.hasFeedback&&this.inputType!='hidden'&&!this.allowBlank&&(this.getValue().length||this.forceFeedback)){var A=this.el.select('.form-control-feedback',true).first();if(A){this.el.select('.form-control-feedback',true).first().removeClass([this.invalidFeedbackClass,this.validFeedbackClass]); +A.update('');}if(this.indicator){this.indicator.removeClass('visible');this.indicator.addClass(this.indicatorpos=='right'?'hidden':'invisible');}if(this.disabled){return;}if(this.allowBlank&&!this.getRawValue().length){return;}if(Roo.bootstrap.version==3){this.el.addClass(this.validClass); +}else{this.inputEl().addClass('is-valid');}if(this.hasFeedback&&this.inputType!='hidden'){var A=this.el.select('.form-control-feedback',true).first();if(A){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(A){if(!this.el||this.preventMark){return;}this.el.removeClass([this.invalidClass,this.validClass]);this.inputEl().removeClass(['is-valid','is-invalid']); -var B=this.el.select('.form-control-feedback',true).first();if(B){this.el.select('.form-control-feedback',true).first().removeClass([this.invalidFeedbackClass,this.validFeedbackClass]);}if(this.disabled){return;}if(this.allowBlank&&!this.getRawValue().length){return; -}if(this.indicator){this.indicator.removeClass(this.indicatorpos=='right'?'hidden':'invisible');this.indicator.addClass('visible');}if(Roo.bootstrap.version==3){this.el.addClass(this.invalidClass);}else{this.inputEl().addClass('is-invalid');}if(this.hasFeedback&&this.inputType!='hidden'&&!this.allowBlank){var B=this.el.select('.form-control-feedback',true).first(); -if(B){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]); +var B=this.el.select('.form-control-feedback',true).first();if(B){this.el.select('.form-control-feedback',true).first().removeClass([this.invalidFeedbackClass,this.validFeedbackClass]);B.update('');}if(this.disabled){return;}if(this.allowBlank&&!this.getRawValue().length){return; +}if(this.indicator){this.indicator.removeClass(this.indicatorpos=='right'?'hidden':'invisible');this.indicator.addClass('visible');}if(Roo.bootstrap.version==3){this.el.addClass(this.invalidClass);}else{this.inputEl().addClass('is-invalid');}if(this.hasFeedback&&this.inputType!='hidden'){var B=this.el.select('.form-control-feedback',true).first(); +if(B){this.el.select('.form-control-feedback',true).first().removeClass([this.invalidFeedbackClass,this.validFeedbackClass]);this.el.select('.form-control-feedback',true).first().addClass([this.invalidFeedbackClass]);B.update(this.invalidText);if(!this.allowBlank&&!this.getRawValue().length){B.update(this.blankText); }}}this.fireEvent('invalid',this,A);},SafariOnKeyDown:function(A){if(this.inputEl().dom.type!='password'){return;}var B=false;if(this.inputEl().dom.selectionEnd>0){B=(this.inputEl().dom.selectionEnd-this.inputEl().dom.selectionStart-this.getValue().length==0)?true:false; }if(((A.getKey()==8||A.getKey()==46)&&this.getValue().length==1)){A.preventDefault();this.setValue('');return;}if(B&&A.getCharCode()>31&&!A.ctrlKey){A.preventDefault();var cc=String.fromCharCode(A.getCharCode());this.setValue(A.shiftKey?cc:cc.toLowerCase()); }},adjustWidth:function(A,w){A=A.toLowerCase();if(typeof w=='number'&&Roo.isStrict&&!Roo.isSafari){if(Roo.isIE&&(A=='input'||A=='textarea')){if(A=='input'){return w+2;}if(A=='textarea'){return w-2;}}else if(Roo.isOpera){if(A=='input'){return w+2;}if(A=='textarea'){return w-2; @@ -577,18 +577,17 @@ this.fieldLabel=v;}}); Roo.bootstrap.form.TextArea=function(A){Roo.bootstrap.form.TextArea.superclass.constructor.call(this,A);};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 A=(!this.labelAlign)?this.parentLabelAlign():this.labelAlign; var id=Roo.id();var B={};if(this.inputType!='hidden'){B.cls='form-group'}var C={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){C.maxLength=this.maxLength; }if(this.resize){C.style=(typeof(C.style)=='undefined')?'resize:'+this.resize:C.style+'resize:'+this.resize;}if(this.cols){C.cols=this.cols;}if(this.readOnly){C.readonly=true;}if(this.name){C.name=this.name;}if(this.size){C.cls=(typeof(C.cls)=='undefined')?'input-'+this.size:C.cls+' input-'+this.size; -}var D=this;['xs','sm','md','lg'].map(function(G){if(D[G]){B.cls+=' col-'+G+'-'+D[G];}});var E=C;if(this.hasFeedback&&!this.allowBlank){var F={tag:'span',cls:'glyphicon form-control-feedback'};E={cls:'has-feedback',cn:[C,F]};}if(this.before||this.after){E={cls:'input-group',cn:[]} -;if(this.before){E.cn.push({tag:'span',cls:'input-group-addon',html:this.before});}E.cn.push(C);if(this.hasFeedback&&!this.allowBlank){E.cls+=' has-feedback';E.cn.push(F);}if(this.after){E.cn.push({tag:'span',cls:'input-group-addon',html:this.after});}}B=this.getAutoCreateLabel(B,E); +}var D=this;['xs','sm','md','lg'].map(function(G){if(D[G]){B.cls+=' col-'+G+'-'+D[G];}});var E=C;if(this.hasFeedback){var F={tag:'span',cls:'glyphicon form-control-feedback'};E={cls:'has-feedback',cn:[C,F]};}if(this.before||this.after){E={cls:'input-group',cn:[]} +;if(this.before){E.cn.push({tag:'span',cls:'input-group-addon',html:this.before});}E.cn.push(C);if(this.hasFeedback){E.cls+=' has-feedback';E.cn.push(F);}if(this.after){E.cn.push({tag:'span',cls:'input-group-addon',html:this.after});}}B=this.getAutoCreateLabel(B,E); if(this.disabled){C.disabled=true;}return B;},inputEl:function(){return this.el.select('textarea.form-control',true).first();},clearInvalid:function(){if(!this.el||this.preventMark){return;}var A=this.el.select('label',true).first();this.el.removeClass(this.validClass); -this.inputEl().removeClass('is-invalid');if(this.hasFeedback&&this.inputType!='hidden'&&!this.allowBlank){var B=this.el.select('.form-control-feedback',true).first();if(B){this.el.select('.form-control-feedback',true).first().removeClass(this.invalidFeedbackClass); +this.inputEl().removeClass('is-invalid');if(this.hasFeedback&&this.inputType!='hidden'){var B=this.el.select('.form-control-feedback',true).first();if(B){this.el.select('.form-control-feedback',true).first().removeClass(this.invalidFeedbackClass);B.update(''); }}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 A=this.el.select('.form-control-feedback',true).first(); -if(A){this.el.select('.form-control-feedback',true).first().removeClass([this.invalidFeedbackClass,this.validFeedbackClass]);}if(this.disabled||this.allowBlank){return;}var B=this.el.select('label',true).first();var C=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'&&!this.allowBlank&&(this.getValue().length||this.forceFeedback)){var A=this.el.select('.form-control-feedback',true).first(); -if(A){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(A){if(!this.el||this.preventMark){return; -}this.el.removeClass([this.invalidClass,this.validClass]);this.inputEl().removeClass(['is-valid','is-invalid']);var B=this.el.select('.form-control-feedback',true).first();if(B){this.el.select('.form-control-feedback',true).first().removeClass([this.invalidFeedbackClass,this.validFeedbackClass]); -}if(this.disabled){return;}var C=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'&&!this.allowBlank){var B=this.el.select('.form-control-feedback',true).first(); -if(B){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.fireEvent('invalid',this,A);}}); +if(A){this.el.select('.form-control-feedback',true).first().removeClass([this.invalidFeedbackClass,this.validFeedbackClass]);A.update('');}if(this.disabled||this.allowBlank){return;}var B=this.el.select('label',true).first();var C=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 A=this.el.select('.form-control-feedback',true).first();if(A){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(A){if(!this.el||this.preventMark){return;}this.el.removeClass([this.invalidClass,this.validClass]);this.inputEl().removeClass(['is-valid','is-invalid']); +var B=this.el.select('.form-control-feedback',true).first();if(B){this.el.select('.form-control-feedback',true).first().removeClass([this.invalidFeedbackClass,this.validFeedbackClass]);B.update('');}if(this.disabled){return;}var C=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 B=this.el.select('.form-control-feedback',true).first();if(B){this.el.select('.form-control-feedback',true).first().removeClass([this.invalidFeedbackClass,this.validFeedbackClass]); +this.el.select('.form-control-feedback',true).first().addClass([this.invalidFeedbackClass]);B.update(this.invalidText);if(!this.allowBlank&&!this.getRawValue().length){B.update(this.blankText);}}}this.fireEvent('invalid',this,A);}}); // Roo/bootstrap/form/TriggerField.js Roo.bootstrap.form.TriggerField=function(A){this.mimicing=false;Roo.bootstrap.form.TriggerField.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.form.TriggerField,Roo.bootstrap.form.Input,{hideTrigger:false,removable:false,autoSize:Roo.emptyFn,monitorTab:true,deferHeight:true,actionMode:'wrap',caret:false,getAutoCreate:function(){var A=this.labelAlign||this.parentLabelAlign(); var id=Roo.id();var B={cls:'form-group'};var C={tag:'input',id:id,type:this.inputType,cls:'form-control',autocomplete:'new-password',placeholder:this.placeholder||''};if(this.name){C.name=this.name;}if(this.size){C.cls+=' input-'+this.size;}if(this.disabled){C.disabled=true; -- 2.39.2