MDL-35402 forms - prevent crash when multiple rules defined on an editor element

This commit is contained in:
Davo Smith
2013-10-15 14:30:33 +01:00
parent f8eff10319
commit d79d07175e
+4 -3
View File
@@ -2135,8 +2135,9 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless {
}
}
//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'])) {
@@ -2144,8 +2145,8 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless {
}
}
// 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
}
}