changeset 554:bff49c2fc3df

Update probe form and button status on save.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 06 Mar 2015 17:00:14 +0100
parents d73942e6e1c6
children 7f8e64c5bd2e
files app/controller/ProbeForm.js
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/ProbeForm.js	Fri Mar 06 13:25:15 2015 +0100
+++ b/app/controller/ProbeForm.js	Fri Mar 06 17:00:14 2015 +0100
@@ -35,12 +35,19 @@
                 if (response.action !== 'create' &&
                     json &&
                     json.success) {
+                    button.setDisabled(true);
+                    button.up('toolbar').down('button[action=discard]')
+                        .setDisabled(true);
+                    formPanel.clearMessages();
                     formPanel.setRecord(record);
                     formPanel.setMessages(json.errors, json.warnings);
                 }
             },
             failure: function(record, response) {
-                console.log('failed...');
+                button.setDisabled(true);
+                button.up('toolbar').down('button[action=discard]')
+                    .setDisabled(true);
+                formPanel.getForm().loadRecord(formPanel.getForm().getRecord());
                 var json = response.request.scope.reader.jsonData;
                 if (json) {
                     formPanel.setMessages(json.errors, json.warnings);

http://lada.wald.intevation.org