MDL-38356 Forms: Check that the form exists before applying changechecker

Signed-off-by: Andrew Robert Nicols <[email protected]>
This commit is contained in:
Brent Boghosian
2013-03-13 18:04:18 +00:00
committed by Andrew Robert Nicols
parent 1bfc006d96
commit d749cbc9a2
+5
View File
@@ -17,6 +17,11 @@ YUI.add('moodle-core-formchangechecker',
initializer : function(config) {
var formid = 'form#' + this.get('formid');
if (!currentform) {
// If the form was not found, then we can't check for changes.
return;
}
// Add change events to the form elements
Y.all(formid + ' input').once('change', M.core_formchangechecker.set_form_changed, this);
Y.all(formid + ' textarea').once('change', M.core_formchangechecker.set_form_changed, this);