diff --git a/lib/formslib.php b/lib/formslib.php index e5314863403..fe7c5c28835 100644 --- a/lib/formslib.php +++ b/lib/formslib.php @@ -2745,7 +2745,7 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{ /** * Create advance group of elements * - * @param object $group Passed by reference + * @param MoodleQuickForm_group $group Passed by reference * @param bool $required if input is required field * @param string $error error message to display */ @@ -2753,6 +2753,12 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{ // Make sure the element has an id. $group->_generateId(); + // Prepend 'fgroup_' to the ID we generated. + $groupid = 'fgroup_' . $group->getAttribute('id'); + + // Update the ID. + $group->updateAttributes(array('id' => $groupid)); + if (method_exists($group, 'getElementTemplateType')){ $html = $this->_elementTemplates[$group->getElementTemplateType()]; }else{ @@ -2772,7 +2778,7 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{ }else{ $html =str_replace('{help}', '', $html); } - $html =str_replace('{id}', 'fgroup_' . $group->getAttribute('id'), $html); + $html = str_replace('{id}', $group->getAttribute('id'), $html); $html =str_replace('{name}', $group->getName(), $html); $html =str_replace('{type}', 'fgroup', $html); $html =str_replace('{class}', $group->getAttribute('class'), $html);