Permalink
Browse files

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

…tor element
  • Loading branch information...
1 parent 5c74090 commit 5ef9103c67045e43af971a2aa34c48adde8718e9 @davosmith davosmith committed Oct 15, 2013
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/formslib.php
View
@@ -2133,17 +2133,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 5ef9103

Please sign in to comment.