diff app/view/form/Messprogramm.js @ 1212:3e6756b0fc97

Fix and complement validation of Messprogramm from.
author Tom Gottfried <tom@intevation.de>
date Thu, 13 Oct 2016 14:42:26 +0200
parents a24de34d6423
children 390dabbf27ed
line wrap: on
line diff
--- a/app/view/form/Messprogramm.js	Tue Oct 11 17:40:37 2016 +0200
+++ b/app/view/form/Messprogramm.js	Thu Oct 13 14:42:26 2016 +0200
@@ -115,7 +115,10 @@
                                 labelWidth: 95,
                                 allowBlank: false,
                                 editable: true,
-                                hidden: true
+                                hidden: true,
+                                listeners: {
+                                    validitychange: me.mstLaborValidity
+                                }
                             }, {
                                 xtype: 'messstelle',
                                 name: 'laborMstId',
@@ -125,7 +128,10 @@
                                 labelWidth: 95,
                                 allowBlank: false,
                                 editable: true,
-                                hidden: true
+                                hidden: true,
+                                listeners: {
+                                    validitychange: me.mstLaborValidity
+                                }
                             }, {
                                 xtype: 'netzbetreiber',
                                 name: 'netzbetreiberId',
@@ -482,6 +488,17 @@
         i.setMaxValue(max-1);
     },
 
+    /*
+     * Set validity of messstellelabor field (not part of the form) based
+     * on validitychange event of hidden mstId and laborMstId
+     */
+    mstLaborValidity: function(field, isValid) {
+        if (!isValid) {
+            field.up('fieldset').down('messstellelabor')
+                .down('combobox').markInvalid('');
+        }
+    },
+
     setRecord: function(messRecord) {
         this.clearMessages();
         this.getForm().loadRecord(messRecord);

http://lada.wald.intevation.org