Permalink
Browse files

MDL-35402 forms - prevent crash when multiple rules defined on an edi…

…tor element
  • Loading branch information...
1 parent f8eff10 commit d79d07175eb5481fe227e863584e2e77c747998c @davosmith davosmith committed Oct 15, 2013
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/formslib.php
View
@@ -2135,17 +2135,18 @@ function getValidationScript()
}
}
//for editor element, [text] is appended to the name.
+ $fullelementname = $elementName;
if ($element->getType() == 'editor') {
- $elementName .= '[text]';
+ $fullelementname .= '[text]';
//Add format to rule as moodleform check which format is supported by browser
//it is not set anywhere... So small hack to make sure we pass it down to quickform
if (is_null($rule['format'])) {
$rule['format'] = $element->getFormat();
}
}
// Fix for bug displaying errors for elements in a group
- $test[$elementName][0][] = $registry->getValidationScript($element, $elementName, $rule);
- $test[$elementName][1]=$element;
+ $test[$fullelementname][0][] = $registry->getValidationScript($element, $fullelementname, $rule);
+ $test[$fullelementname][1]=$element;
//end of fix
}
}

0 comments on commit d79d071

Please sign in to comment.