Skip to content

Commit

Permalink
MDL-70987 core_form: Use correct id for elementid during validation
Browse files Browse the repository at this point in the history
The id of the formid was being passed instead of the elementid.
  • Loading branch information
andrewnicols committed Feb 24, 2021
1 parent a93828a commit 972e6ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/formslib.php
Expand Up @@ -2579,7 +2579,7 @@ function validate_' . $this->_formName . '_' . $escapedElementName . '(element,
}
}
// This handles both randomised (MDL-65217) and non-randomised IDs.
$errorid = preg_replace('/^id_/', 'id_error_', $this->_attributes['id']);
$errorid = preg_replace('/^id_/', 'id_error_', $elem->_attributes['id']);
$validateJS .= '
ret = validate_' . $this->_formName . '_' . $escapedElementName.'(frm.elements[\''.$elementName.'\'], \''.$escapedElementName.'\') && ret;
if (!ret && !first_focus) {
Expand Down

0 comments on commit 972e6ff

Please sign in to comment.