Mercurial > lada > lada-client
diff app/view/widget/base/Datetime.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 | 67963fcb7739 |
children | c75f13578315 |
line wrap: on
line diff
--- a/app/view/widget/base/Datetime.js Wed Apr 08 17:03:59 2015 +0200 +++ b/app/view/widget/base/Datetime.js Mon Apr 13 16:22:34 2015 +0200 @@ -17,7 +17,7 @@ ], layout: 'hbox', - + tooltip: null, border: 0, margin: '0, 0, 5, 0', @@ -31,7 +31,8 @@ flex: 1, name: this.name, msgTarget: 'none', - listeners: this.listeners + listeners: this.listeners, + period: this.period }); this.items = [dateField, { xtype: 'image', @@ -52,11 +53,12 @@ }, showWarnings: function(warnings) { + this.clearWarningOrError(); var img = this.down('image[name=warnImg]'); - Ext.create('Ext.tip.ToolTip', { + this.tooltip = (!this.tooltip) ? Ext.create('Ext.tip.ToolTip', { target: img.getEl(), html: warnings - }); + }) : this.tooltip.html = warnings; this.down('datetimefield').invalidCls = 'x-lada-warning'; this.down('datetimefield').markInvalid(''); img.show(); @@ -69,13 +71,14 @@ }, showErrors: function(errors) { + this.clearWarningOrError(); var img = this.down('image[name=errorImg]'); var warnImg = this.down('image[name=warnImg]'); warnImg.hide(); - Ext.create('Ext.tip.ToolTip', { + this.tooltip = (!this.tooltip) ? Ext.create('Ext.tip.ToolTip', { target: img.getEl(), html: errors - }); + }) : this.tooltip.html = errors; this.down('datetimefield').invalidCls = 'x-lada-error'; this.down('datetimefield').markInvalid(''); img.show(); @@ -88,6 +91,7 @@ }, clearWarningOrError: function() { + this.down('datetimefield').clearInvalid(); this.down('image[name=errorImg]').hide(); this.down('image[name=warnImg]').hide(); },