[Lada-commits] [PATCH] Fix regex and validate more expressively and stringently

Wald Commits scm-commit at wald.intevation.org
Fri May 27 18:07:47 CEST 2016


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1464365264 -7200
# Node ID 1cf5280bbc451d38ff6a9722840df468db12cf24
# Parent  645f888e34be6ff80ab114d06857b00636b8adb0
Fix regex and validate more expressively and stringently.

diff -r 645f888e34be -r 1cf5280bbc45 app/controller/form/Ortszuordnung.js
--- a/app/controller/form/Ortszuordnung.js	Fri May 27 14:52:56 2016 +0200
+++ b/app/controller/form/Ortszuordnung.js	Fri May 27 18:07:44 2016 +0200
@@ -152,7 +152,9 @@
      */
     dirtyForm: function(form, dirty) {
         if (dirty) {
-            if (form.getValues().ortId !== '') {
+            if (form.getValues().ortId !== ''
+                && /[UEZA]/.test(form.getValues().ortszuordnungTyp)
+               ) {
                 form.owner.down('button[action=save]').setDisabled(false);
             }
             form.owner.down('button[action=discard]').setDisabled(false);
diff -r 645f888e34be -r 1cf5280bbc45 app/view/form/Ortszuordnung.js
--- a/app/view/form/Ortszuordnung.js	Fri May 27 14:52:56 2016 +0200
+++ b/app/view/form/Ortszuordnung.js	Fri May 27 18:07:44 2016 +0200
@@ -79,11 +79,12 @@
                         name: 'ortszusatztext',
                         fieldLabel: i18n.getMsg('ortszuordnung.form.field.ortszusatztext')
                     }, {
-                        xtype: 'tfield',
+                        xtype: 'textfield',
                         labelWidth: 125,
                         maxLength: 1,
                         allowBlank: false,
-                        regex: /[U,E,Z,A]/,
+                        regex: /[UEZA]/,
+                        activeError: 'U, E, Z oder A eingeben',
                         name: 'ortszuordnungTyp',
                         fieldLabel: i18n.getMsg('ortszuordnung.form.field.ortszuordnungtyp')
                     }, {
@@ -219,12 +220,11 @@
 
     clearMessages: function() {
         this.down('tfield[name=ortszusatztext]').clearWarningOrError();
-        this.down('tfield[name=ortszuordnungTyp]').clearWarningOrError();
      },
 
     setReadOnly: function(value) {
         this.down('tfield[name=ortszusatztext]').setReadOnly(value);
-        this.down('tfield[name=ortszuordnungTyp]').setReadOnly(value);
+        this.down('textfield[name=ortszuordnungTyp]').setReadOnly(value);
     }
 });
 


More information about the Lada-commits mailing list