[Zope] Selecting an option in a drop-down list in DTML

Geir Bækholt Geir Bækholt <geirh@funcom.com>
Wed, 8 May 2002 13:21:53 +0200


on or about, Wednesday, May 08, 2002, we have reason to believe that
Richard McKinley wrote something along the lines of :

RM> I want to be able to add the SELECTED HTML attribute to a specific opti=
on=20
RM> which is determined only at runtime.  Basically if the current value of=
=20
RM> research_purpose field equals the value of the purpose variable I want =
to=20
RM> insert the select attribute at this point.

[snip]

RM> However, I get a syntax error.  How do you usually test the condition w=
hen 2=20
RM> variable are equal=3F


<dtml-if expr=3D"RESEARCH_PURPOSE =3D=3D PURPOSE">  selected=3Dselected
</dtml-if>

:-)

stuff inside quotes is the same as inside expr=3D"" , meaning a
python-expression.. You cannot use DTML in python expressions.


--=20
Geir B=E6kholt                      web-developer
geirh@funcom.com             funcom oslo | webdev-team