[ZPT] <select><option selected> question

Peter Bengtsson mail@peterbe.com
Mon, 16 Jul 2001 11:06:57 +0200


Even, is this the "best" way to do it?

> <select name="location">
>     <option tal:define="template_location template_info/location"
>                  tal:repeat="location here/locations">
>                  tal:condition="location"
>                  tal:attributes="value location/ID;selected
> python:template_location==location.name"
>                  tal:content="location/name"
>     >Location Name</option>
> </select>

http://www.zope.org/Members/peterbe/DTML2ZPT/examples/example14/view

This explains how to do <input type="checkbox" checked> too.

> From: <daniel.a.fulton@delphiauto.com>
> > is this the best way to do an <select><option selected> tag set? it
works
> but I
> > thought there might
> > be a shorter route that I missed.
>
> Somewhat shorter:
>
> <select name="location">
>     <option tal:define="template_location template_info/location"
>                  tal:repeat="location here/locations">
>                  tal:condition="location"
>                  tal:attributes="value location/ID;selected
> python:template_location==location.name"
>                  tal:content="location/name"
>     >Location Name</option>
> </select>
>
> Cheers,
>
> Evan @ digicool
>
>
> _______________________________________________
> ZPT mailing list
> ZPT@zope.org
> http://lists.zope.org/mailman/listinfo/zpt