diff app/controller/form/Ortserstellung.js @ 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 d8db43ac9c12
children 49efc1cc0eac
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);
             }
         });
     },

http://lada.wald.intevation.org