[Zope] selected in select lists

Garry Saddington garry at schoolteachers.co.uk
Fri Oct 14 15:03:47 EDT 2005


Chris Withers wrote:

> Garry Saddington wrote:
>
>> DTML:
>> <select name="groupabbrev">
>> <dtml-in getpastoralgroups>
>> <option value="<dtml-var thisgroupabbrev>" <dtml-if 
>> expr="groupabbrev==_.str(thisgroupabbrev)"> selected</dtml-if> 
>>  ><dtml-var thisgroupabbrev></option>
>> </dtml-in>
>> </select>
>
>
> And just for comparison, here's the ZPT:
>
> <select name="groupabbrev"
>         tal:define="abbrev context/groupabbrev">
>   <tal:i repeat="group context/getpastoralgroups"
>   <option tal:define="thisAbbrev group/thisgroupabbrev"
>           tal:attributes="value thisAbbrev;
>                           selected python:abbrev==thisAbbrev"
>           tal:content="thisAbbrev"/>
> </select>
>
> Stop using DTML ;-)
>
> Chris
>
This code does not work;-). If I always work in the ZMI and do not 
collaborate with designers on database web applications where the data
is more important than the presentation, can you give me a good reason 
for not using DTML. I find DTML more intuitive than ZPT and once you get 
the hang of
the namespace magic thing it is not that bad. The ZPT code above seems 
to me more complex and it has defined two new variables, whereas the 
DTML only has two variables
and a string conversion.
Regards
Garry
ps. I would use ZPT if I could see a valid reason to do so.



More information about the Zope mailing list