[Zope] selected in select lists
Chris Withers
chris at simplistix.co.uk
Fri Oct 14 06:02:23 EDT 2005
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
--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
More information about the Zope
mailing list