MDL-26649 forms: ensure that both necessary variables are set before altering calenda...
authorMark Nelson <markn@moodle.com>
Wed, 10 Apr 2013 03:18:17 +0000 (11:18 +0800)
committerDamyon Wiese <damyon@moodle.com>
Wed, 10 Apr 2013 04:48:13 +0000 (12:48 +0800)
lib/form/yui/dateselector/dateselector.js

index 4d490e4..08beea6 100644 (file)
@@ -86,9 +86,11 @@ YUI.add('moodle-form-dateselector', function(Y) {
                     node.on('click', this.toggle_calendar_image, this);
                     // Set the node to the enablecheckbox variable.
                     this.enablecheckbox = node;
+                }
+                // Ensure that the calendarimage and enablecheckbox values have been set.
+                if (this.calendarimage && this.enablecheckbox) {
                     // Set the calendar icon status depending on the value of the checkbox.
-                    // QUICK HACK to keep JS working. MDL-26649. FIXME!
-                    // this.toggle_calendar_image();
+                    this.toggle_calendar_image();
                 }
             }, this);
         },