diff app/view/widget/base/FieldSet.js @ 717:f124d24c8ade

Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
author Dustin Demuth <dustin@intevation.de>
date Mon, 13 Apr 2015 16:22:34 +0200
parents 1e1534482bfd
children c2a6f7caa71b
line wrap: on
line diff
--- a/app/view/widget/base/FieldSet.js	Wed Apr 08 17:03:59 2015 +0200
+++ b/app/view/widget/base/FieldSet.js	Mon Apr 13 16:22:34 2015 +0200
@@ -14,8 +14,10 @@
     origColor: '',
     errorText: '',
     warningText: '',
+    tooltip: null,
 
     showWarningOrError: function(warning, warningText, error, errorText) {
+        this.clearMessages(); //Clear Errors and Warning first
         var ndx = 0;
         if (this.collapsible === true) {
             ndx = 1;
@@ -39,10 +41,15 @@
                     '<img src="resources/img/emblem-important.png" width="13" height="13" />  ' +
                     this.plainTitle;
             if (errorText) {
-                Ext.create('Ext.tip.ToolTip', {
-                    target: this.getEl().dom.firstChild.firstChild.firstChild.children[ndx],
-                    html: errorText
-                });
+                if (!this.tooltip) {
+                    Ext.create('Ext.tip.ToolTip', {
+                        target: this.getEl().dom.firstChild.firstChild.firstChild.children[ndx],
+                        html: errorText
+                    });
+                }
+                else {
+                    tooltip.html = errorText;
+                }
             }
             return;
         }
@@ -53,10 +60,15 @@
                     '<img src="resources/img/dialog-warning.png" width="13" height="13" />  ' +
                     this.plainTitle;
             if (warningText) {
-                Ext.create('Ext.tip.ToolTip', {
-                    target: this.getEl().dom.firstChild.firstChild.firstChild.children[ndx],
-                    html: warningText
-                });
+                if (!this.tooltip) {
+                    Ext.create('Ext.tip.ToolTip', {
+                        target: this.getEl().dom.firstChild.firstChild.firstChild.children[ndx],
+                        html: warningText
+                    });
+                }
+                else {
+                    tooltip.html = warningText;
+                }
             }
             return;
         }

http://lada.wald.intevation.org