diff app/controller/form/Ortserstellung.js @ 1352:e5235309d461

fixed validitycheck in Ortserstellung
author Maximilian Krambach <mkrambach@intevation.de>
date Tue, 07 Feb 2017 15:04:45 +0100
parents d5e270fa91e4
children 02252ce0cf1e
line wrap: on
line diff
--- a/app/controller/form/Ortserstellung.js	Tue Feb 07 14:55:34 2017 +0100
+++ b/app/controller/form/Ortserstellung.js	Tue Feb 07 15:04:45 2017 +0100
@@ -37,7 +37,11 @@
             },
             'ortserstellungsform numfield [name=koordYExtern]': {
                 change: this.checkCommitEnabled
-            }
+            },
+            'ortserstellungsform': {
+                validitychange: this.checkCommitEnabled,
+                dirtychange: this.checkCommitEnabled
+            },
         });
     },
 
@@ -128,12 +132,12 @@
      * checks if the Messpunkt can be committed.
      * Disables the save button if false
      */
-    checkCommitEnabled: function(field) {
+    checkCommitEnabled: function(callingEl) {
         var panel;
-        if (field.up('panel')) {
-            panel = field.up('panel').up('panel');
-        } else {
-            panel = field;
+        if (callingEl.up) { //called by a field in the form
+            panel = callingEl.up('panel').up('panel');
+        } else { //called by the form
+            panel = callingEl.owner;
         }
         var savebutton =  panel.down('button[action=save]');
         var form = panel.getForm();

http://lada.wald.intevation.org