Re: [SMARTY] Html_radios with labels?

From: Date: Mon, 12 Jan 2004 20:02:31 +0000
Subject: Re: [SMARTY] Html_radios with labels?
References: 1 2  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-10813@lists.php.net to get a copy of this message
On Sun, Jan 11, 2004 at 02:04:17PM +0100, Andreas Goetz wrote: > Messju, > > Same issue with check boxes. Opera 7 btw treats it right, seems to be an IE > issue. Any chance to get this included? Sure. I just wonder if "$label_name . '_' . $radio_value' is unique enough for this purpose it doesn't break anyone's css definitions. I suggest we introduce an additional (optional) attribute "id_prefix" (default '') that as prepended to the id so people can add another level of uniqueness to theirs radios' (and checkboxes') ids if they need. > Thanks, > > Andreas Goetz > cpuidle@gmx.de > http://www.cpuidle.de > > > > -----Original Message----- > > From: messju mohr [mailto:messju@lammfellpuschen.de] > > Sent: Donnerstag, 8. Januar 2004 14:02 > > To: Andreas Goetz > > Cc: smarty-general@lists.php.net > > Subject: Re: [SMARTY] Html_radios with labels? > > > > On Wed, Jan 07, 2004 at 09:58:44AM +0100, Andreas Goetz wrote: > > > Hi, > > > > > > html_radios with labels doesn't allow clicking on the > > labels (at least IE). > > > The following smarty-created code doesn't work: > > > > > > <form action="index.php" method="get"> > > > <label><input type="radio" > > > name="filter" value="NY" />New York</label> > > > <label><input > > type="radio" > > > name="filter" value="NE" checked="checked" > > > />Nebraska</label> <label><input type="radio" > > > name="filter" > > value="KS" > > > />Kansas</label> <label><input type="radio" > > > name="filter" value="IA" > > > />Iowa</label> <label><input type="radio" > > > name="filter" value="OK" > > > />Oklahoma</label> <label><input type="radio" > > > name="filter" > > value="TX" > > > />Texas</label> </form> > > > > > > It seems that at least IE need a <label for="id"> attribute to work > > > correctly. I'm therefore suggesting the following change to > > add the 'for' > > > and 'id' attributes: > > > > OTOH the standard says the id is optional, but of course > > actual implementations may differ. > > > > a question to the list: is an id "$name_$value" unique > > enough, so that it does not interfere with other ids on the webpage? > > > > if so, we should add that id, IMHO. > > > > BTW: does html_checkboxes have the same problem? > > > > greetings > > messju > > > > > > > function smarty_function_html_radios_output($name, $value, $output, > > > $selected, $extra, $separator, $labels) { > > > $_output = ''; > > > if ($labels) $_output .= '<label > > > > > for="'.smarty_function_escape_special_chars($name).smarty_function_esc > > > ape_sp > > > ecial_chars($value).'">'; > > > $_output .= '<input type="radio" name="' > > > . smarty_function_escape_special_chars($name) . '" id="' > > > . > > > > > smarty_function_escape_special_chars($name).smarty_function_escape_spe > > > cial_c > > > hars($value) . '" value="' > > > . smarty_function_escape_special_chars($value) . '"'; > > > > > > if ($value==$selected) { > > > $_output .= ' checked="checked"'; > > > } > > > $_output .= $extra . ' />' . $output; > > > > > > if ($labels) $_output .= '</label>'; > > > $_output .= $separator . "\n"; > > > > > > return $_output; > > > } > > > > > > > > > Andreas Goetz > > > cpuidle@gmx.de > > > http://www.cpuidle.de > > > > > > > > > -- > > > Smarty General Mailing List (http://smarty.php.net/) To > > unsubscribe, > > > visit: http://www.php.net/unsub.php > > > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.smarty.general (#10813) next »