From 18f3ad8372f611a61460441719c12c174e597c30 Mon Sep 17 00:00:00 2001 From: skodak Date: Mon, 8 Jan 2007 08:00:46 +0000 Subject: [PATCH] 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 --- lib/formslib.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/formslib.php b/lib/formslib.php index 7dcab2a1f9704..5c2abd7885e18 100644 --- a/lib/formslib.php +++ b/lib/formslib.php @@ -1369,9 +1369,6 @@ function renderElement(&$element, $required, $error){ $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 @@ function renderElement(&$element, $required, $error){ $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('