[ZDP] Selecting an option from a drop-down list at runtime in DTML

Chris McDonough chrism@zope.com
Thu, 25 Jul 2002 19:01:15 -0400

Richard McKinley wrote:
> I want to be able to add the SELECTED HTML attribute to a specific 
> option which is determined only at runtime.  Basically if the current 
> value of research_purpose field equals the value of the purpose variable 
> I want to insert the select attribute at this point.
>      <dtml-if expr="<dtml-var "RESEARCH_PURPOSE"> == <dtml-var "PURPOSE">">
>          SELECTED
>      </dtml-if>
> However, I get a syntax error.  How do you usually test the condition 
> when 2 variable are equal?

<dtml-if expr="RESEARCH_PURPOSE == PURPOSE">SELECTED</dtml-if>

Note that is question is better asked on the main Zope list 
(zope@zope.org).  The ZDP list is kinda dead.


- C

Chris McDonough                    Zope Corporation
http://www.zope.org             http://www.zope.com
"Killing hundreds of birds with thousands of stones"