[ZPT] option selected?
robert
robert at redcor.ch
Mon Jan 5 14:26:50 EST 2004
I think your problem is that you just have to have the word "selected" to mark
an option as selected.
<select name="categoryId">
<option value="1" >Foo</option>
<option value="2" "selected">Bar</option>
<option value="3">Snafu</option>
</select>
<
On Monday 05 January 2004 20:15, cccurvey wrote:
> Ack! I'm both confused and off-topic! I'm trying to make sure that
> the select box that's in the form reflects the state of the record
> that was retrieved from the database (and I'm using the SimpleTAL
> package from owlfish.com to do this outside of Zope).
>
> Category:
> <select name="categoryId">
> <option tal:repeat="category categoryList"
> tal:attributes="selected
> python:category['categoryId']==case.categoryId;
> value category/categoryId"
> tal:content="category/categoryName">
> </option>
> </select>
>
> This all works well and gives me something like
>
> <select name="categoryId">
> <option value="1" selected="false">Foo</option>
> <option value="2" selected="true">Bar</option>
> <option value="3" selected="false">Snafu</option>
> </select>
>
> But the problem is that the browsers seem to be always selecting the
> last item in the list. It appears that they pick the last option with
> a "selected" attribute, regardless of what the value is.
>
> How do I work around this to only put the "selected" tag on the option
> which is actually selected?
>
> If I'm too far off-topic, let me know and I'll be quiet.
>
> Thanks!
>
>
> _______________________________________________
> ZPT mailing list
> ZPT at zope.org
> http://mail.zope.org/mailman/listinfo/zpt
More information about the ZPT
mailing list