[ZPT] option selected?
Jeffrey P Shell
jeff at bottlerocket.net
Mon Jan 5 18:28:56 EST 2004
On Jan 5, 2004, at 12:34 PM, Casey Duncan wrote:
> 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".
This is only true in HTML mode. XML mode renders values, since the XML
spec requires all attributes to have one. I don't know about
SimpleTAL's behavior, but the original author might check to see how
they have SimpleTAL rendering.
More information about the ZPT
mailing list