From a1d81f3e06581da45688de68def9d02becd12ced Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sat, 27 Jun 2009 10:18:44 +0000 Subject: [PATCH] "if label_for starts with a '#', it is already an id - no need to create default id from it" --- etemplate/inc/class.etemplate.inc.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/etemplate/inc/class.etemplate.inc.php b/etemplate/inc/class.etemplate.inc.php index d5b980aa62..40779d1447 100644 --- a/etemplate/inc/class.etemplate.inc.php +++ b/etemplate/inc/class.etemplate.inc.php @@ -1687,8 +1687,15 @@ class etemplate extends boetemplate } if ($label && !$readonly && ($accesskey || $label_for || $type != 'label' && $cell['name'])) { - $label = html::label($label,$label_for ? self::form_name($cname,$label_for) : - $form_name.($set_val?"[$set_val]":''),$accesskey); + if ($label_for) // if label_for starts with a '#', it is already an id - no need to create default id from it + { + $label_for = $label_for[0] == '#' ? substr($label_for,1) : self::form_name($cname,$label_for); + } + else + { + $label_for = $form_name.($set_val?"[$set_val]":''); + } + $label = html::label($label,$label_for,$accesskey); } if ($type == 'radio' || $type == 'checkbox' || $label && strpos($label,'%s')!==false) // default for radio is label after the button {