changeset 1357:b96d98f0cb71

Fix handling of errors and warnings in Ortserstellung form.
author Tom Gottfried <tom@intevation.de>
date Tue, 07 Feb 2017 18:25:18 +0100
parents 81b585645581
children 2e462c5334f1
files app/controller/form/Ortserstellung.js app/view/form/Ortserstellung.js
diffstat 2 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/form/Ortserstellung.js	Tue Feb 07 17:18:13 2017 +0100
+++ b/app/controller/form/Ortserstellung.js	Tue Feb 07 18:25:18 2017 +0100
@@ -99,11 +99,8 @@
 
             },
             failure: function(record, response) {
-                var json = Ext.decode(response.response.responseText);
+                var json = response.request.scope.reader.jsonData;
                 if (json) {
-                    if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){
-                        formPanel.setMessages(json.errors, json.warnings);
-                    }
                     if(json.message){
                         Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title')
                             +' #'+json.message,
@@ -112,11 +109,12 @@
                          Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
                              Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
                     }
+                    me.clearMessages();
+                    me.setMessages(json.errors, json.warnings);
                 } else {
                     Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
                         Lada.getApplication().bundle.getMsg('err.msg.response.body'));
                 }
-                me.setDisabled(true);
             }
         });
     },
--- a/app/view/form/Ortserstellung.js	Tue Feb 07 17:18:13 2017 +0100
+++ b/app/view/form/Ortserstellung.js	Tue Feb 07 18:25:18 2017 +0100
@@ -39,7 +39,7 @@
             labelWidth: 125,
             value: Lada.netzbetreiber[0]
         }, {
-            xtype: 'textfield',
+            xtype: 'tfield',
             name: 'ortId',
             maxLength: 10,
             labelWidth: 125,

http://lada.wald.intevation.org