option selected
"Simon McCaughey" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.petal |
|---|---|
| Message-ID | <013401c4e545$a4c19270$70a1a02f@AtticPC> |
I can't seem to get a reasonable solution to the option selected problem, basically I'm going through a list, adding options for each item, and if the one is selected then add a selected attribute
this is what I'm doing:
<select name="category">
<option tal:repeat="cat cat_list" value="$cat/id">
$cat/name
</option>
</select>
and what I think I need is :
<select name="category">
<option tal:repeat="cat cat_list" tal:attributes="selected if: eq: $cat/id $item/cat/id then: true else: false" value="$cat/id">
$cat/name
</option>
</select>
This is my first attempt at this, please don't laugh, I just started today :)
Simon