comparison app/controller/form/Ortserstellung.js @ 1352:e5235309d461

fixed validitycheck in Ortserstellung
author Maximilian Krambach <mkrambach@intevation.de>
date Tue, 07 Feb 2017 15:04:45 +0100
parents d5e270fa91e4
children 02252ce0cf1e
comparison
equal deleted inserted replaced
1351:036c594de978 1352:e5235309d461
35 'ortserstellungsform numfield [name=koordXExtern]': { 35 'ortserstellungsform numfield [name=koordXExtern]': {
36 change: this.checkCommitEnabled 36 change: this.checkCommitEnabled
37 }, 37 },
38 'ortserstellungsform numfield [name=koordYExtern]': { 38 'ortserstellungsform numfield [name=koordYExtern]': {
39 change: this.checkCommitEnabled 39 change: this.checkCommitEnabled
40 } 40 },
41 'ortserstellungsform': {
42 validitychange: this.checkCommitEnabled,
43 dirtychange: this.checkCommitEnabled
44 },
41 }); 45 });
42 }, 46 },
43 47
44 save: function(button) { 48 save: function(button) {
45 var me = button.up('panel'); 49 var me = button.up('panel');
126 130
127 /** 131 /**
128 * checks if the Messpunkt can be committed. 132 * checks if the Messpunkt can be committed.
129 * Disables the save button if false 133 * Disables the save button if false
130 */ 134 */
131 checkCommitEnabled: function(field) { 135 checkCommitEnabled: function(callingEl) {
132 var panel; 136 var panel;
133 if (field.up('panel')) { 137 if (callingEl.up) { //called by a field in the form
134 panel = field.up('panel').up('panel'); 138 panel = callingEl.up('panel').up('panel');
135 } else { 139 } else { //called by the form
136 panel = field; 140 panel = callingEl.owner;
137 } 141 }
138 var savebutton = panel.down('button[action=save]'); 142 var savebutton = panel.down('button[action=save]');
139 var form = panel.getForm(); 143 var form = panel.getForm();
140 if (form.isDirty()) { 144 if (form.isDirty()) {
141 panel.down('button[action=revert]').setDisabled(false); 145 panel.down('button[action=revert]').setDisabled(false);

http://lada.wald.intevation.org