Permalink
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 cce0d9a commit 7e21ee683bede47660af65415ac87ac4398093e6 @brentboghosian brentboghosian committed with andrewnicols Mar 6, 2013
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/yui/formchangechecker/formchangechecker.js
@@ -18,6 +18,11 @@ YUI.add('moodle-core-formchangechecker',
var formid = 'form#' + this.get('formid'),
currentform = Y.one(formid);
+ if (!currentform) {
+ // If the form was not found, then we can't check for changes.
+ return;
+ }
+
// Add change events to the form elements
currentform.delegate('change', M.core_formchangechecker.set_form_changed, 'input', this);
currentform.delegate('change', M.core_formchangechecker.set_form_changed, 'textarea', this);

0 comments on commit 7e21ee6

Please sign in to comment.