fix mandatory star on html/textarea
authorAlan <alan@roojs.com>
Wed, 11 Jan 2023 05:03:59 +0000 (13:03 +0800)
committerAlan <alan@roojs.com>
Wed, 11 Jan 2023 05:03:59 +0000 (13:03 +0800)
Roo/bootstrap/form/TextArea.js
roojs-bootstrap-debug.js
roojs-bootstrap.js

index efb1a5b..2c35437 100644 (file)
@@ -171,11 +171,11 @@ Roo.extend(Roo.bootstrap.form.TextArea, Roo.bootstrap.form.Input,  {
         }
         
         var label = this.el.select('label', true).first();
-        var icon = this.el.select('i.fa-star', true).first();
+        //var icon = this.el.select('i.fa-star', true).first();
         
-        if(label && icon){
-            icon.remove();
-        }
+        //if(label && icon){
+        //    icon.remove();
+        //}
         this.el.removeClass( this.validClass);
         this.inputEl().removeClass('is-invalid');
          
@@ -217,9 +217,9 @@ Roo.extend(Roo.bootstrap.form.TextArea, Roo.bootstrap.form.Input,  {
         var label = this.el.select('label', true).first();
         var icon = this.el.select('i.fa-star', true).first();
         
-        if(label && icon){
-            icon.remove();
-        }
+        //if(label && icon){
+        //    icon.remove();
+        //}
         if (Roo.bootstrap.version == 3) {
             this.el.addClass(this.validClass);
         } else {
@@ -265,16 +265,17 @@ Roo.extend(Roo.bootstrap.form.TextArea, Roo.bootstrap.form.Input,  {
         }
         
         var label = this.el.select('label', true).first();
-        var icon = this.el.select('i.fa-star', true).first();
+        //var icon = this.el.select('i.fa-star', true).first();
         
-        if(!this.getValue().length && label && !icon){
-            this.el.createChild({
+        //if(!this.getValue().length && label && !icon){
+          /*  this.el.createChild({
                 tag : 'i',
                 cls : 'text-danger fa fa-lg fa-star',
                 tooltip : 'This field is required',
                 style : 'margin-right:5px;'
             }, label, true);
-        }
+            */
+        //}
         
         if (Roo.bootstrap.version == 3) {
             this.el.addClass(this.invalidClass);
index e81543e..338ba77 100644 (file)
@@ -13565,11 +13565,11 @@ Roo.extend(Roo.bootstrap.form.TextArea, Roo.bootstrap.form.Input,  {
         }
         
         var label = this.el.select('label', true).first();
-        var icon = this.el.select('i.fa-star', true).first();
+        //var icon = this.el.select('i.fa-star', true).first();
         
-        if(label && icon){
-            icon.remove();
-        }
+        //if(label && icon){
+        //    icon.remove();
+        //}
         this.el.removeClass( this.validClass);
         this.inputEl().removeClass('is-invalid');
          
@@ -13611,9 +13611,9 @@ Roo.extend(Roo.bootstrap.form.TextArea, Roo.bootstrap.form.Input,  {
         var label = this.el.select('label', true).first();
         var icon = this.el.select('i.fa-star', true).first();
         
-        if(label && icon){
-            icon.remove();
-        }
+        //if(label && icon){
+        //    icon.remove();
+        //}
         if (Roo.bootstrap.version == 3) {
             this.el.addClass(this.validClass);
         } else {
@@ -13659,16 +13659,17 @@ Roo.extend(Roo.bootstrap.form.TextArea, Roo.bootstrap.form.Input,  {
         }
         
         var label = this.el.select('label', true).first();
-        var icon = this.el.select('i.fa-star', true).first();
+        //var icon = this.el.select('i.fa-star', true).first();
         
-        if(!this.getValue().length && label && !icon){
-            this.el.createChild({
+        //if(!this.getValue().length && label && !icon){
+          /*  this.el.createChild({
                 tag : 'i',
                 cls : 'text-danger fa fa-lg fa-star',
                 tooltip : 'This field is required',
                 style : 'margin-right:5px;'
             }, label, true);
-        }
+            */
+        //}
         
         if (Roo.bootstrap.version == 3) {
             this.el.addClass(this.invalidClass);
index 5778f0b..bef5f06 100644 (file)
@@ -575,16 +575,16 @@ var id=Roo.id();var B={};if(this.inputType!='hidden'){B.cls='form-group'}var C={
 }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);
-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();var B=this.el.select('i.fa-star',true).first();
-if(A&&B){B.remove();}this.el.removeClass(this.validClass);this.inputEl().removeClass('is-invalid');if(this.hasFeedback&&this.inputType!='hidden'&&!this.allowBlank){var C=this.el.select('.form-control-feedback',true).first();if(C){this.el.select('.form-control-feedback',true).first().removeClass(this.invalidFeedbackClass);
+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.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(B&&C){C.remove();}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(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||this.allowBlank){return;}var C=this.el.select('label',true).first();var D=this.el.select('i.fa-star',true).first();if(!this.getValue().length&&C&&!D){this.el.createChild({tag:'i',cls:'text-danger fa fa-lg fa-star',tooltip:'This field is required',style:'margin-right:5px;'}
-,C,true);}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(this.disabled||this.allowBlank){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);}});
 // 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;