[Zope] iterating over key/value pairs
John Hunter
jdhunter@ace.bsd.uchicago.edu
Tue, 01 Jan 2002 14:06:47 -0600
I would like to dynamically generate a list with an HTML SELECT tag
where the displayed values are strings and the returned value is an
integer code associated with that string
I have access to two External Methods, one returns a list of strings
and the other returns a list of codes associated with those strings:
get_descriptions() and get_codes()
The DTML I currently have is
<SELECT NAME="race">
<dtml-in expr="get_descriptions()">
<OPTION VALUE="<dtml-var sequence-item>"><dtml-var sequence-item></OPTION>
</dtml-in>
</SELECT>
but this returns the string selected, and I want the code returned, as
I indicate below with 'code-here'
<SELECT NAME="race">
<dtml-in expr="get_descriptions()">
<OPTION VALUE="code-here"><dtml-var sequence-item></OPTION>
</dtml-in>
</SELECT>
I can add or modify the External Methods to return something more
appropriate if necessary. Is there a way for an external method to
return objects that would have 'code' and 'description' attributes
that dtml-var could access?
Thanks,
John Hunter