Browse files

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

…cker

Signed-off-by: Andrew Robert Nicols <andrew.nicols@luns.net.uk>
  • Loading branch information...
1 parent 215c189 commit ab13a532be41a7e9bd8d03314c1b6c26d01d53b3 @brentboghosian brentboghosian committed with andrewnicols Mar 6, 2013
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/yui/formchangechecker/formchangechecker.js
View
5 lib/yui/formchangechecker/formchangechecker.js
@@ -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);

0 comments on commit ab13a53

Please sign in to comment.