comparison app/view/form/Probe.js @ 717:f124d24c8ade

Datevalidation. When editing a timeperiod in a Probeform it is validated wheter begindate is before enddate. This only happens when the blur-event is fired. ToDo: Listen to Events from the Übernehmen Button of the DateTimePicker, ToDo: Somehow the ErrorMessages are not Cleared correctly when the form is restored.
author Dustin Demuth <dustin@intevation.de>
date Mon, 13 Apr 2015 16:22:34 +0200
parents 0391425689ed
children 7f11b75e0188
comparison
equal deleted inserted replaced
716:b400629a2575 717:f124d24c8ade
231 type: 'hbox', 231 type: 'hbox',
232 pack: 'center', 232 pack: 'center',
233 align: 'stretch' 233 align: 'stretch'
234 }, 234 },
235 items: [{ 235 items: [{
236 xtype: 'fieldset', 236 xtype: 'fset',
237 title: 'Probenentnahme', 237 title: 'Probenentnahme',
238 name: 'entnahmePeriod',
238 anchor: '100%', 239 anchor: '100%',
239 width: '50%', 240 width: '50%',
240 margin: '0, 5, 5, 5', 241 margin: '0, 5, 5, 5',
241 layout: { 242 layout: {
242 type: 'vbox', 243 type: 'vbox',
246 xtype: 'datetime', 247 xtype: 'datetime',
247 fieldLabel: 'Beginn', 248 fieldLabel: 'Beginn',
248 labelWidth: 90, 249 labelWidth: 90,
249 anchor: '100%', 250 anchor: '100%',
250 name: 'probeentnahmeBeginn', 251 name: 'probeentnahmeBeginn',
251 format: 'd.m.Y H:i' 252 format: 'd.m.Y H:i',
253 period: 'start'
252 }, { 254 }, {
253 xtype: 'datetime', 255 xtype: 'datetime',
254 fieldLabel: 'Ende', 256 fieldLabel: 'Ende',
255 labelWidth: 90, 257 labelWidth: 90,
256 anchor: '100%', 258 anchor: '100%',
257 name: 'probeentnahmeEnde', 259 name: 'probeentnahmeEnde',
258 format: 'd.m.Y H:i' 260 format: 'd.m.Y H:i',
261 period: 'end'
259 }] 262 }]
260 }, { 263 }, {
261 xtype: 'fieldset', 264 xtype: 'fset',
262 title: 'Sollzeitraum', 265 title: 'Sollzeitraum',
266 name: 'sollzeitPeriod',
263 anchor: '100%', 267 anchor: '100%',
264 width: '50%', 268 width: '50%',
265 margin: '0, 5, 5, 5', 269 margin: '0, 5, 5, 5',
266 layout: { 270 layout: {
267 type: 'vbox', 271 type: 'vbox',
271 xtype: 'datetime', 275 xtype: 'datetime',
272 fieldLabel: 'Von', 276 fieldLabel: 'Von',
273 labelWidth: 90, 277 labelWidth: 90,
274 anchor: '100%', 278 anchor: '100%',
275 name: 'solldatumBeginn', 279 name: 'solldatumBeginn',
276 format: 'd.m.Y H:i' 280 format: 'd.m.Y H:i',
281 period: 'start'
277 }, { 282 }, {
278 xtype: 'datetime', 283 xtype: 'datetime',
279 fieldLabel: 'Bis', 284 fieldLabel: 'Bis',
280 labelWidth: 90, 285 labelWidth: 90,
281 anchor: '100%', 286 anchor: '100%',
282 name: 'solldatumEnde', 287 name: 'solldatumEnde',
283 format: 'd.m.Y H:i' 288 format: 'd.m.Y H:i',
289 period: 'end'
284 }] 290 }]
285 }] 291 }]
286 }] 292 }]
287 }] 293 }]
288 }]; 294 }];
289 this.callParent(arguments); 295 this.callParent(arguments);
290 }, 296 },
291 297
292 setRecord: function(record) { 298 setRecord: function(record) {
299 this.clearMessages();
293 this.getForm().loadRecord(record); 300 this.getForm().loadRecord(record);
294 }, 301 },
295 302
296 setMessages: function(errors, warnings) { 303 setMessages: function(errors, warnings) {
297 var key; 304 var key;
341 this.down('datetime[name=probeentnahmeBeginn]').clearWarningOrError(); 348 this.down('datetime[name=probeentnahmeBeginn]').clearWarningOrError();
342 this.down('datetime[name=probeentnahmeEnde]').clearWarningOrError(); 349 this.down('datetime[name=probeentnahmeEnde]').clearWarningOrError();
343 this.down('datetime[name=solldatumBeginn]').clearWarningOrError(); 350 this.down('datetime[name=solldatumBeginn]').clearWarningOrError();
344 this.down('datetime[name=solldatumEnde]').clearWarningOrError(); 351 this.down('datetime[name=solldatumEnde]').clearWarningOrError();
345 //this.down('numberfield[name=probeNehmerId]').clearWarningOrError(); 352 //this.down('numberfield[name=probeNehmerId]').clearWarningOrError();
353 this.down('fset[name=entnahmePeriod]').clearMessages();
354 this.down('fset[name=sollzeitPeriod]').clearMessages();
346 }, 355 },
347 356
348 setReadOnly: function(value) { 357 setReadOnly: function(value) {
349 this.down('cbox[name=mstId]').setReadOnly(value); 358 this.down('cbox[name=mstId]').setReadOnly(value);
350 this.down('tfield[name=hauptprobenNr]').setReadOnly(value); 359 this.down('tfield[name=hauptprobenNr]').setReadOnly(value);

http://lada.wald.intevation.org