comparison 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
comparison
equal deleted inserted replaced
1356:81b585645581 1357:b96d98f0cb71
97 scope: this 97 scope: this
98 }); 98 });
99 99
100 }, 100 },
101 failure: function(record, response) { 101 failure: function(record, response) {
102 var json = Ext.decode(response.response.responseText); 102 var json = response.request.scope.reader.jsonData;
103 if (json) { 103 if (json) {
104 if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){
105 formPanel.setMessages(json.errors, json.warnings);
106 }
107 if(json.message){ 104 if(json.message){
108 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title') 105 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title')
109 +' #'+json.message, 106 +' #'+json.message,
110 Lada.getApplication().bundle.getMsg(json.message)); 107 Lada.getApplication().bundle.getMsg(json.message));
111 } else { 108 } else {
112 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'), 109 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
113 Lada.getApplication().bundle.getMsg('err.msg.generic.body')); 110 Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
114 } 111 }
112 me.clearMessages();
113 me.setMessages(json.errors, json.warnings);
115 } else { 114 } else {
116 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'), 115 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
117 Lada.getApplication().bundle.getMsg('err.msg.response.body')); 116 Lada.getApplication().bundle.getMsg('err.msg.response.body'));
118 } 117 }
119 me.setDisabled(true);
120 } 118 }
121 }); 119 });
122 }, 120 },
123 121
124 discard: function(button) { 122 discard: function(button) {

http://lada.wald.intevation.org