changeset 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 5e91a740aff8
children 36c2cd8d6c54
files app/controller/form/Messung.js app/controller/form/Probe.js app/view/form/Probe.js app/view/widget/base/FieldSet.js
diffstat 4 files changed, 22 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/form/Messung.js	Wed Apr 15 16:20:44 2015 +0200
+++ b/app/controller/form/Messung.js	Wed Apr 15 18:34:23 2015 +0200
@@ -80,7 +80,12 @@
                          Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
                             Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
                     }
-                }
+                    formPanel.clearMessages();
+                    formPanel.setRecord(record);
+                    formPanel.setMessages(json.errors, json.warnings);
+                    formPanel.up('window').initData();
+                    formPanel.up('window').grid.store.reload();
+                  }
                 else {
                     Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
                         Lada.getApplication().bundle.getMsg('err.msg.response.body'));
--- a/app/controller/form/Probe.js	Wed Apr 15 16:20:44 2015 +0200
+++ b/app/controller/form/Probe.js	Wed Apr 15 18:34:23 2015 +0200
@@ -73,10 +73,14 @@
                          Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
                             Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
                     }
+                    formPanel.clearMessages();
+                    formPanel.setRecord(record);
+                    formPanel.setMessages(json.errors, json.warnings);
                 } else {
                     Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
                         Lada.getApplication().bundle.getMsg('err.msg.response.body'));
                 }
+
             }
         });
     },
--- a/app/view/form/Probe.js	Wed Apr 15 16:20:44 2015 +0200
+++ b/app/view/form/Probe.js	Wed Apr 15 18:34:23 2015 +0200
@@ -100,6 +100,7 @@
                         items: [{
                             xtype: 'fset',
                             title: 'Erweiterte Angaben',
+                            name: 'erwAngaben',
                             collapsible: true,
                             collapsed: true,
                             items: [{
@@ -350,6 +351,7 @@
         this.down('datetime[name=solldatumBeginn]').clearWarningOrError();
         this.down('datetime[name=solldatumEnde]').clearWarningOrError();
         //this.down('numberfield[name=probeNehmerId]').clearWarningOrError();
+        this.down('fset[name=erwAngaben]').clearMessages();
         this.down('fset[name=entnahmePeriod]').clearMessages();
         this.down('fset[name=sollzeitPeriod]').clearMessages();
     },
--- 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