diff --git a/lib/formslib.php b/lib/formslib.php index 30f291d659a..88d0226d809 100644 --- a/lib/formslib.php +++ b/lib/formslib.php @@ -2746,11 +2746,10 @@ require([ ' . $valFunc . ' }); '; - } - } - // This handles both randomised (MDL-65217) and non-randomised IDs. - $errorid = preg_replace('/^id_/', 'id_error_', $elem->_attributes['id']); - $validateJS .= ' + + // This handles both randomised (MDL-65217) and non-randomised IDs. + $errorid = preg_replace('/^id_/', 'id_error_', $elem->_attributes['id']); + $validateJS .= ' ret = validate_' . $this->_formName . '_' . $escapedElementName.'(frm.elements[\''.$elementName.'\'], \''.$escapedElementName.'\') && ret; if (!ret && !first_focus) { first_focus = true; @@ -2762,6 +2761,8 @@ require([ } '; + } + } // Fix for bug displaying errors for elements in a group //unset($element); //$element =& $this->getElement($elementName);