From: Stephen Burrows Date: Thu, 7 Apr 2011 16:22:55 +0000 (-0400) Subject: Merge branch 'gilbert' into gilbert-1.3 X-Git-Url: http://git.ithinksw.org/philo.git/commitdiff_plain/fdf8e669733ebdd25c98afc11fcf95bcb79a5126?hp=-c Merge branch 'gilbert' into gilbert-1.3 --- fdf8e669733ebdd25c98afc11fcf95bcb79a5126 diff --combined contrib/gilbert/static/gilbert/lib/ui/forms.js index 719b7b1,ca7f4e6..ca7f4e6 --- a/contrib/gilbert/static/gilbert/lib/ui/forms.js +++ b/contrib/gilbert/static/gilbert/lib/ui/forms.js @@@ -322,7 -322,7 +322,7 @@@ Gilbert.lib.ui.DateTimeField = Ext.exte // render DateField and TimeField // create bounding table var t; - if ('below' === this.timePosition || 'bellow' === this.timePosition) { + if ('below' === this.timePosition) { t = Ext.DomHelper.append(ct, { tag: 'table', style: 'border-collapse:collapse', @@@ -582,7 -582,18 +582,18 @@@ */ , isValid: function() { - return this.df.isValid() && this.tf.isValid(); + var valid = true; + var msg = "Both fields must be supplied." + if (!(this.df.isValid() && this.tf.isValid())) valid = false; + if (Boolean(this.df.getValue()) != Boolean(this.tf.getValue())) { + valid = false; + if (!this.df.getValue()){ + if (!(this.tf.hasFocus || this.df.hasFocus)) this.df.markInvalid(msg); + } else { + if (!(this.tf.hasFocus || this.df.hasFocus)) this.tf.markInvalid(msg); + }; + }; + return valid; } // eo function isValid // }}} @@@ -838,9 -849,6 +849,6 @@@ if (d) { if (! (this.dateValue instanceof Date)) { this.initDateValue(); - if (!this.tf.getValue()) { - this.setTime(this.dateValue); - } } this.dateValue.setMonth(0); // because of leap years @@@ -850,7 -858,6 +858,6 @@@ } else { this.dateValue = ''; - this.setTime(''); } } // eo function updateDate @@@ -868,7 -875,6 +875,6 @@@ } if (t && !this.df.getValue()) { this.initDateValue(); - this.setDate(this.dateValue); } if (this.dateValue instanceof Date) { if (t) { @@@ -919,7 -925,18 +925,18 @@@ */ , validate: function() { - return this.df.validate() && this.tf.validate(); + var valid = true; + var msg = "Both fields must be supplied." + if (!(this.df.validate() && this.tf.validate())) valid = false; + if (Boolean(this.df.getValue()) != Boolean(this.tf.getValue())) { + valid = false; + if (!this.df.getValue()){ + if (!(this.tf.hasFocus || this.df.hasFocus)) this.df.markInvalid(msg); + } else { + if (!(this.tf.hasFocus || this.df.hasFocus)) this.tf.markInvalid(msg); + }; + }; + return valid; } // eo function validate // }}}