Re: [SMARTY-DEV] html_options

From: Date: Mon, 26 Feb 2007 13:23:50 +0000
Subject: Re: [SMARTY-DEV] html_options
References: 1 2 3  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-2971@lists.php.net to get a copy of this message
On Mon, Feb 26, 2007 at 01:44:58PM +0100, Danilo Buerger wrote: > messju mohr schrieb: > >Hi, > > > >what about multiple selected values, then? > > Good point, but that raises another bug. When using multiple selected > values, the <select> tag should have a multiple="multiple" attribute. Of > course this could be applied by a feature where every attribute in the > {html_options} that isnt one of values/output/selected/options/name is > appended to the <select> tag (if present). It's the responsobility of the editor who inserts the {html_options} into the template to declare it as multiple or not. > So i guess the approach > should be if name is specified and multiple select values exist > multiple="multiple" should be automatically applied to the <select> tag > (if present). Here is a patch for this, which also fixes the first issue > but keeps the selected attribute as array: > > Index: plugins/function.html_options.php > =================================================================== > RCS file: /repository/smarty/libs/plugins/function.html_options.php,v > retrieving revision 1.25 > diff -r1.25 function.html_options.php > 58c58 > < $$_key = array_map('strval', array_values((array)$_val)); > --- > > $$_key = array_values((array)$_val); > 90a91,93 > > if (count($selected) > 1) { > > $extra = ' multiple="multiple"' . $extra; > > } -1 the fact if an option list is single or multiple is most times rather static, but the list of actually selected values is highly dynamic.

« previous php.smarty.dev (#2971) next »