changeset 1144:5ceb0381ae73

Set a regex and required for ortszuordnungstyp field.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 27 May 2016 14:51:12 +0200
parents 255d550e74f4
children 7ac4d811cf89
files app/controller/form/Ortszuordnung.js app/view/form/Ortszuordnung.js app/view/widget/base/TextField.js
diffstat 3 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/form/Ortszuordnung.js	Thu May 26 14:56:41 2016 +0200
+++ b/app/controller/form/Ortszuordnung.js	Fri May 27 14:51:12 2016 +0200
@@ -152,7 +152,9 @@
      */
     dirtyForm: function(form, dirty) {
         if (dirty) {
-            form.owner.down('button[action=save]').setDisabled(false);
+            if (form.getValues().ortId !== '') {
+                form.owner.down('button[action=save]').setDisabled(false);
+            }
             form.owner.down('button[action=discard]').setDisabled(false);
         }
         else {
--- a/app/view/form/Ortszuordnung.js	Thu May 26 14:56:41 2016 +0200
+++ b/app/view/form/Ortszuordnung.js	Fri May 27 14:51:12 2016 +0200
@@ -81,7 +81,9 @@
                     }, {
                         xtype: 'tfield',
                         labelWidth: 125,
-                        maxLength: 100,
+                        maxLength: 1,
+                        allowBlank: false,
+                        regex: /[U,E,Z,A]/,
                         name: 'ortszuordnungTyp',
                         fieldLabel: i18n.getMsg('ortszuordnung.form.field.ortszuordnungtyp')
                     }, {
--- a/app/view/widget/base/TextField.js	Thu May 26 14:56:41 2016 +0200
+++ b/app/view/widget/base/TextField.js	Fri May 27 14:51:12 2016 +0200
@@ -28,7 +28,7 @@
             enforceMaxLength: this.enforceMaxLength || true,
             fieldLabel: this.fieldLabel,
             labelWidth: this.labelWidth,
-            readOnly: this.readOnly || false, 
+            readOnly: this.readOnly || false,
             listeners: this.listeners
         }, {
             xtype: 'image',
@@ -46,6 +46,12 @@
             hidden: true
         }];
         this.callParent(arguments);
+        if (this.regex) {
+            Ext.apply(this.down('textfield'), {regex: this.regex});
+        }
+        if (this.allowBlank === false) {
+            Ext.apply(this.down('textfield'), {allowBlank: this.allowBlank});
+        }
     },
 
     showWarnings: function(warnings) {

http://lada.wald.intevation.org