J Cameron Cooper wrote:
Garry Saddington wrote:
I have a variable called 'groupabbrev' in the REQUEST. I am trying to
automatically select an option in a select list based on this variable.
I have tried this code and many others, and many googles but have not
found anything that works. Can anyone see what I am doing wrong?
<select name="groupabbrev">
<dtml-in getpastoralgroups>
<option value="<dtml-var groupabbrev>" <dtml-if
expr="'groupabbrev'==_['sequence-item']"> selected</dtml-if>
><dtml-var groupabbrev></option>
</dtml-in>
</select>
Why have you put 'groupabbrev' in quotes?
I am fishing in the dark
That makes it a string, and the condition will only be true when the
current item is equal to "groupabbrev".
Presumably you want the value of the variable named that, rather than
a string of that name.
Also, watch the values of what 'getpastoralgroups' returns. The
condition will never be true if they are not strings or converted into
such.
--jcc
Now I have tried both of the following with no result:
<dtml-if expr="groupabbrev==_.str(_['sequence-item'])">
<dtml-if expr="groupabbrev==_['sequence-item']">
Are there any other ways I could try?
regards
Garry
_______________________________________________
Zope maillist - Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )