changeset 1352:e5235309d461

fixed validitycheck in Ortserstellung
author Maximilian Krambach <mkrambach@intevation.de>
date Tue, 07 Feb 2017 15:04:45 +0100
parents 036c594de978
children 39dbdfa00c91
files app/controller/form/Ortserstellung.js app/view/form/Ortserstellung.js
diffstat 2 files changed, 10 insertions(+), 8 deletions(-) [+]
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();
--- a/app/view/form/Ortserstellung.js	Tue Feb 07 14:55:34 2017 +0100
+++ b/app/view/form/Ortserstellung.js	Tue Feb 07 15:04:45 2017 +0100
@@ -182,8 +182,6 @@
         }];
         this.callParent(arguments);
         this.getForm().loadRecord(this.record);
-        var controller = Lada.app.getController('Lada.controller.form.Ortserstellung')
-        controller.checkCommitEnabled(this);
     },
 
     setMessages: function(errors, warnings) {

http://lada.wald.intevation.org