From: skodak Date: Mon, 8 Jan 2007 08:00:46 +0000 (+0000) Subject: xhtml fix - now only 'for=' with wrong id is removed from labels - static and grouped... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=18f3ad8372f611a61460441719c12c174e597c30;p=moodle.git xhtml fix - now only 'for=' with wrong id is removed from labels - static and grouped elemenst (date selector), because the missing label might cause problems with CSS styling --- diff --git a/lib/formslib.php b/lib/formslib.php index 7dcab2a1f9..5c2abd7885 100644 --- a/lib/formslib.php +++ b/lib/formslib.php @@ -1369,9 +1369,6 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{ $html = str_replace('{help}', '', $html); } - if ($element->getType() == 'static') { - $html = preg_replace('/()|(<\/label>)/i', '', $html); //xhtml compliance - no label for static content - } $this->_templates[$element->getName()] = $html; if (!is_null($element->getAttribute('id'))) { $id = $element->getAttribute('id'); @@ -1383,6 +1380,11 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{ $element->updateAttributes(array('id'=>'id_'.$id)); } parent::renderElement($element, $required, $error); + if ($element->getType() == 'static' or $element->getType() == 'date_selector' or $element->getType() == 'date_time_selector') { + //xhtml compliance - remove 'for' attribute from label if element with id does not exist + //TODO: is there a better way to do it? + $this->_html = str_replace('