[Zope] Newbie Question (dropdown menu)

Jim Washington jwashin@vt.edu
Wed, 21 Jun 2000 13:02:46 -0400


Hi, Joel

<untested>

Just displaying the list in a <select>:

<select name="whatever">
<dtml-in ZSQLMethodthatgetsthelist>
<option value="<dtml-var theFieldname>"><dtml-var theFieldname></option>
</dtml-in>
</select>

If "whatever" already has a value and you want that selected:

<select name="whatever">
<dtml-in ZSQLMethodthatgetsthelist>
<option value="<dtml-var theFieldname>"
<dtml-if "whatever == theFieldname"> selected </dtml-if>>
<dtml-var theFieldname></option>
</dtml-in>
</select>

</untested>

the </option> tags are apparently optional.

hth

-- Jim Washington

joel grimes wrote:
> 
> I'm trying to fill a combo-box (pardon the vb-centric lingo - I don't know
> what the things are called - it's a <select...><option...> thing) with items
> selected from a table.  I haven't a clue how to do this.  I've got the ODBC
> Connection and SQL Method working, but how do I iterate through the query
> results to fill a drop-down?
> 
> Thanks
> 
> Joel Grimes