[ZPT] option selected?

Marc Lindahl marc at bowery.com
Mon Jan 5 19:10:09 EST 2004


Hey, That's good to know!  Is that documented anywhere, I don't recall 
seeing it (and I was just doing that the other day....)

On Monday, January 5, 2004, at 02: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".
>
> I suspect SimpleTAL does not do this.
>
> -Casey
>
> _______________________________________________
> ZPT mailing list
> ZPT at zope.org
> http://mail.zope.org/mailman/listinfo/zpt




More information about the ZPT mailing list