diff app/controller/form/Ortszuordnung.js @ 1341:2e8eba3918b1

OrtszuordnungMp fix
author Maximilian Krambach <mkrambach@intevation.de>
date Fri, 03 Feb 2017 21:43:52 +0100
parents 1a2cd9bef6d7
children cd16b30dbc10
line wrap: on
line diff
--- a/app/controller/form/Ortszuordnung.js	Fri Feb 03 20:35:53 2017 +0100
+++ b/app/controller/form/Ortszuordnung.js	Fri Feb 03 21:43:52 2017 +0100
@@ -112,7 +112,7 @@
         var recordData = form.getForm().getRecord().data;
         var currentOrt = null;
         if (recordData.ortId !== undefined) {
-            currentOrt = recordData.ortId;
+            currentOrt = recordData.ortId[0];
         } else {
             currentOrt = recordData.ort;
         }
@@ -191,25 +191,16 @@
      */
     validityChange: function(form, valid) {
         if (form.isDirty()) {
-            if (valid) {
-                if (form.getValues().ortId !== ''
-                    && /[UEZA]/.test(form.getValues().ortszuordnungTyp)) {
-                    // valid ortzuordnung(Probe)
-                    form.owner.down('button[action=save]').setDisabled(false);
-                } else if (form.getValues().ort !== ''
-                    && /[UEZA]/.test(form.getValues().ortsTyp)) {
-                    // valid ortzuordnung(messprogramm)
-                    form.owner.down('button[action=save]').setDisabled(false);
-                } else {
-                    form.owner.down('button[action=save]').setDisabled(true);
-                }
+            form.owner.down('button[action=revert]').setDisabled(false);
+            if (valid && form.getValues().ortId !== '') {
+                form.owner.down('button[action=save]').setDisabled(false);
             } else {
-                //invalid
                 form.owner.down('button[action=save]').setDisabled(true);
             }
         } else {
             //not dirty
             form.owner.down('button[action=save]').setDisabled(true);
+            form.owner.down('button[action=revert]').setDisabled(true);
         }
     }
 });

http://lada.wald.intevation.org