diff app/view/widget/base/FieldSet.js @ 720:c2a6f7caa71b

Fix for ErrorMessages in FieldSets for IE8 IE9
author Dustin Demuth <dustin@intevation.de>
date Wed, 15 Apr 2015 18:34:23 +0200
parents f124d24c8ade
children 36c2cd8d6c54
line wrap: on
line diff
--- a/app/view/widget/base/FieldSet.js	Wed Apr 15 16:20:44 2015 +0200
+++ b/app/view/widget/base/FieldSet.js	Wed Apr 15 18:34:23 2015 +0200
@@ -18,10 +18,6 @@
 
     showWarningOrError: function(warning, warningText, error, errorText) {
         this.clearMessages(); //Clear Errors and Warning first
-        var ndx = 0;
-        if (this.collapsible === true) {
-            ndx = 1;
-        }
         if (this.errorText && this.errorText !== '') {
             this.errorText += '\n';
         }
@@ -30,20 +26,17 @@
             this.warningText += '\n';
         }
         this.warningText += warningText;
-        this.plainTitle = this.getEl().dom.firstChild
-            .firstChild.firstChild
-            .children[ndx].innerHTML;
+        this.plainTitle = this.title;
         this.origColor = this.getEl().dom.style['border-color'];
+        var imgId = Ext.id();
         if (error) {
             this.getEl().dom.style['border-color'] = '#FF0000';
-            this.getEl().dom.firstChild.firstChild.firstChild
-                .children[ndx].innerHTML =
-                    '<img src="resources/img/emblem-important.png" width="13" height="13" />  ' +
-                    this.plainTitle;
+            this.setTitle('<img src="resources/img/emblem-important.png" width="13" height="13" id="'+ imgId +'"/>  '+
+                    this.plainTitle);
             if (errorText) {
                 if (!this.tooltip) {
                     Ext.create('Ext.tip.ToolTip', {
-                        target: this.getEl().dom.firstChild.firstChild.firstChild.children[ndx],
+                        target: imgId,
                         html: errorText
                     });
                 }
@@ -55,16 +48,15 @@
         }
         if (warning) {
             this.getEl().dom.style['border-color'] = '#FFE25D';
-            this.getEl().dom.firstChild.firstChild.firstChild
-                .children[ndx].innerHTML =
-                    '<img src="resources/img/dialog-warning.png" width="13" height="13" />  ' +
-                    this.plainTitle;
+            this.setTitle('<img src="resources/img/dialog-warning.png" width="13" height="13"  id="'+ imgId +'"/>  '+
+                    this.plainTitle);
             if (warningText) {
                 if (!this.tooltip) {
                     Ext.create('Ext.tip.ToolTip', {
-                        target: this.getEl().dom.firstChild.firstChild.firstChild.children[ndx],
+                        target: Ext.get(imgId),
                         html: warningText
                     });
+                debugger;
                 }
                 else {
                     tooltip.html = warningText;
@@ -75,14 +67,8 @@
     },
 
     clearMessages: function() {
-        var ndx = 0;
-        if (this.collapsible === true) {
-            ndx = 1;
-        }
         if (this.plainTitle !== '') {
-            this.getEl().dom.firstChild
-                .firstChild.firstChild
-                .children[ndx].innerHTML = this.plainTitle;
+            this.setTitle(this.plainTitle);
             this.getEl().dom.style['border-color'] = this.origColor;
         }
     }

http://lada.wald.intevation.org