[ZPT] option selected?
Casey Duncan
casey at zope.com
Mon Jan 5 14:34:36 EST 2004
On Mon, 05 Jan 2004 19:15:58 -0000
"cccurvey" <scurvey at nwaf.com> 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>
In ZPT several attributes (selected, disables, nowrap, etc) are
considered "boolean" and are treated specially by tal:attributes. They
are omitted from the output if the value is "False" and inserted only if
the value is "True".
I suspect SimpleTAL does not do this.
-Casey
More information about the ZPT
mailing list