[Zope] selected in select lists
J Cameron Cooper
zope-l at jcameroncooper.com
Wed Oct 12 17:50:05 EDT 2005
Garry Saddington wrote:
> Nicolas Gouzy wrote:
>
>> I think this code works :
>>
>> <select name="groupabbrev">
>> <dtml-in getpastoralgroups>
>> <option value="<dtml-var expr="_['sequence-item']">" <dtml-if
>> expr="groupabbrev==_['sequence-item']"> selected</dtml-if> ><dtml-var
>> expr="_['sequence-item']"></option>
>> </dtml-in>
>> </select>
>>
>> --
>> Nicolas Gouzy
>> nicolas.gouzy at gmail.com
>>
>>
>>
>>
> This producing the following result, is this what it should do?
> <select name="groupabbrev">
> <option value="<Shared.DC.ZRDB.Results.r object at
> 0x43aa7c0c>"><Shared.DC.ZRDB.Results.r object at 0x43aa7c0c></option>
> <option value="<Shared.DC.ZRDB.Results.r object at
> 0x43f95824>"><Shared.DC.ZRDB.Results.r object at 0x43f95824></option>
> <option value="<Shared.DC.ZRDB.Results.r object at
> 0x43aa7c0c>"><Shared.DC.ZRDB.Results.r object at 0x43aa7c0c></option>
> <option value="<Shared.DC.ZRDB.Results.r object at
> 0x43f95824>"><Shared.DC.ZRDB.Results.r object at 0x43f95824></option>
> </select>
Like I said: be careful about what comes out of getpastoralgroups.
These are Result objects, not strings. Like any result objects, they
store data in attributes with the same name as the row that came out of
the SQL results.
You must use a row in your comparison: a Result object can never be
equal to a string.
--jcc
--
"Building Websites with Plone"
http://plonebook.packtpub.com/
Enfold Systems, LLC
http://www.enfoldsystems.com
More information about the Zope
mailing list