Roo/bootstrap/Input.js
authoredward <edward@roojs.com>
Wed, 6 Apr 2016 07:33:30 +0000 (15:33 +0800)
committeredward <edward@roojs.com>
Wed, 6 Apr 2016 07:33:30 +0000 (15:33 +0800)
Roo/bootstrap/Input.js

index 8cdc463..58663c2 100644 (file)
@@ -790,18 +790,23 @@ Roo.extend(Roo.bootstrap.Input, Roo.bootstrap.Component,  {
             return;
         }
         
-        var label = this.el.findParent('.form-group', false, true).select('label', true).first();
-        var icon = this.el.findParent('.form-group', false, true).select('i.fa-star', true).first();
+        var formGroup = this.el.findParent('.form-group', false, true);
         
-        if(!this.getValue().length && label && !icon){
-            this.el.findParent('.form-group', false, true).createChild({
-                tag : 'i',
-                cls : 'text-danger fa fa-lg fa-star',
-                tooltip : 'This field is required',
-                style : 'margin-right:5px;'
-            }, label, true);
+        if(formGroup){
+            var label = formGroup.select('label', true).first();
+            var icon = formGroup.select('i.fa-star', true).first();
+
+            if(!this.getValue().length && label && !icon){
+                this.el.findParent('.form-group', false, true).createChild({
+                    tag : 'i',
+                    cls : 'text-danger fa fa-lg fa-star',
+                    tooltip : 'This field is required',
+                    style : 'margin-right:5px;'
+                }, label, true);
+            }
         }
         
+        
         this.el.addClass(this.invalidClass);
         
         if(this.hasFeedback && this.inputType != 'hidden' && !this.allowBlank){