tags:

views:

268

answers:

1
{html_options values=$row.milestone_id output=$row.title output=$row.title}

hi folks,how to add more $output in smarty html option ?

A: 

The output needs to be an array to populate the dropdown. See the example

PHP code

$smarty->assign('myOptions', array(
                                1800 => 'Joe Schmoe',
                                9904 => 'Jack Smith',
                                2003 => 'Charlie Brown')
                                );
$smarty->assign('mySelect', 9904);

Then the template

{html_options name=foo options=$myOptions selected=$mySelect}

And the output

<select name="foo">
<option label="Joe Schmoe" value="1800">Joe Schmoe</option>
<option label="Jack Smith" value="9904" selected="selected">Jack Smith</option>
<option label="Charlie Brown" value="2003">Charlie Brown</option>
</select>
michal kralik