if(this.attr('disabled') || this.attr('readOnly')) {
return true;
}
+ if(!this.attr('value')) {
+ return false;
+ }
if(orgSettings['ui.patron.edit.ac.barcode.regex']) { // This serves as a master "on" for these checks
// No spaces
if(this.attr("value").match(/\s/)) {
case 'dob':
widget.widget.isValid = function() {
- if(!this.attr('value')) return false;
- if(this.attr('value').getFullYear().toString().length < 4) return false;
+ // KCLS requires DoB.
+ // We're not just using ui.patron.edit.au.dob.require,
+ // because when the DoB is unset, we also want to
+ // clear the juvenile flag.
+ if(!this.attr('value')) {
+ findWidget('au', 'juvenile').widget.attr('value', false);
+ return false;
+ }
+
+ // DoB year <= 999 suggests human error; reject it.
+ if(this.attr('value').getFullYear().toString().length < 4) {
+ findWidget('au', 'juvenile').widget.attr('value', false);
+ return false;
+ }
+
+ // DoB cannot be in the future
return this.attr("value") < new Date();
};
dojo.connect(widget.widget, 'onChange',