comparison app/controller/form/Messprogramm.js @ 777:5a153d36ed4e

ClearMessages
author Dustin Demuth <dustin@intevation.de>
date Tue, 12 May 2015 17:00:22 +0200
parents 311c39a64064
children f0b26df02157
comparison
equal deleted inserted replaced
776:da14e0f3e599 777:5a153d36ed4e
24 click: this.discard 24 click: this.discard
25 }, 25 },
26 'messprogrammform': { 26 'messprogrammform': {
27 dirtychange: this.dirtyForm 27 dirtychange: this.dirtyForm
28 }, 28 },
29 'messprogrammform gueltigPeriod datetime': { 29 'messprogrammform datetime textfield': {
30 blur: this.checkPeriod 30 blur: this.checkDatePeriod
31 }, 31 },
32 'messprogrammform probenintervall numberfield': { 32 'messprogrammform [name="teilintervallVon"]': {
33 change: this.synchronizeSlider, 33 change: this.synchronizeSlider,
34 blur: this.checkPeriod 34 blur: this.checkPeriod
35 }, 35 },
36 'messprogrammform probenintervall combobox': { 36 'messprogrammform [name="teilintervallBis"]': {
37 change: this.synchronizeSlider,
38 blur: this.checkPeriod
39 },
40 'messprogrammform probenintervall combobox': {
37 select: this.updateIntervalls 41 select: this.updateIntervalls
38 } 42 }
39 }); 43 });
40 }, 44 },
41 /** 45 /**
182 * checkPeriod() is called when a fields defining an intervall 186 * checkPeriod() is called when a fields defining an intervall
183 * were modified 187 * were modified
184 * The function validates if the start is smaller than end. 188 * The function validates if the start is smaller than end.
185 */ 189 */
186 checkPeriod: function(field) { 190 checkPeriod: function(field) {
187 alert();
188 // This field might be a field within a Period. 191 // This field might be a field within a Period.
189 // Search for Partner field (period: end/start) and validate 192 // Search for Partner field (period: end/start) and validate
190 // End Before Start validation 193 // End Before Start validation
191 if (field.period) { 194 if (field.period) {
192 var partners = new Array(); 195 var partners = new Array();
197 field.up('fieldset').showWarningOrError(true, msg, false, ''); 200 field.up('fieldset').showWarningOrError(true, msg, false, '');
198 } else { 201 } else {
199 field.up('fieldset').clearMessages(); 202 field.up('fieldset').clearMessages();
200 } 203 }
201 } 204 }
202 } 205 },
203 }); 206
207 /**
208 * checkDatePeriod() is called when a fields defining an intervall
209 * were modified
210 * The function validates if the start is smaller than end.
211 * Same as checkPeriod but requires DATETIME fields
212 */
213 checkDatePeriod: function(field) {
214 // This field might be a field within a Period.
215 // Search for Partner field (period: end/start) and validate
216 // End Before Start validation
217 if (field.period) {
218 var partners = new Array();
219 partners[0] = field.up('fieldset')
220 .down('datetime[period=start]')
221 .down('textfield')
222 .getValue()
223 partners[1] = field.up('fieldset')
224 .down('datetime[period=end]')
225 .down('textfield')
226 .getValue()
227 if (partners[0] && partners[1] && partners[0] > partners [1]) {
228 var msg = Lada.getApplication().bundle.getMsg('662');
229 field.up('fieldset').showWarningOrError(true, msg, false, '');
230 } else {
231 field.up('fieldset').clearMessages();
232 }
233 }
234 }});

http://lada.wald.intevation.org