}
/**
- * Constructor for a JavaScritp object that connects to a fdate_time_selector
+ * Constructor for a JavaScript object that connects to a fdate_time_selector
* or a fdate_selector in a Moodle form, and shows a popup calendar whenever
* that element has keyboard focus.
* @param el the fieldset class="fdate_time_selector" or "fdate_selector".
this.fieldset = el;
var controls = el.getElementsByTagName('select');
for (var i = 0; i < controls.length; i++) {
- YAHOO.util.Event.addFocusListener(controls[i], this.focus_event, this);
- YAHOO.util.Event.addBlurListener(controls[i], this.blur_event, this);
if (/\[year\]$/.test(controls[i].name)) {
this.yearselect = controls[i];
- }
- if (/\[month\]$/.test(controls[i].name)) {
+ } else if (/\[month\]$/.test(controls[i].name)) {
this.monthselect = controls[i];
- }
- if (/\[day\]$/.test(controls[i].name)) {
+ } else if (/\[day\]$/.test(controls[i].name)) {
this.dayselect = controls[i];
+ } else {
+ YAHOO.util.Event.addFocusListener(controls[i], this.cancel_any_timeout, this);
+ YAHOO.util.Event.addBlurListener(controls[i], this.blur_event, this);
}
}
if (!(this.yearselect && this.monthselect && this.dayselect)) {
throw 'Failed to initialise calendar.';
}
+ YAHOO.util.Event.addFocusListener([this.yearselect, this.monthselect, this.dayselect], this.focus_event, this);
+ YAHOO.util.Event.addBlurListener([this.yearselect, this.monthselect, this.dayselect], this.blur_event, this);
this.enablecheckbox = el.getElementsByTagName('input')[0];
if (this.enablecheckbox) {
}
date_selector_calendar.prototype.blur_event = function(e, me) {
- date_selector_calendar.hidetimeout = setTimeout(function() {me.release_calendar()}, 200);
+ date_selector_calendar.hidetimeout = setTimeout(function() {me.release_calendar();}, 200);
}
date_selector_calendar.prototype.handle_select_change = function(e, me) {