[Zope-DB] Drop down list from database

Jim Penny jpenny at universal-fasteners.com
Thu Nov 20 12:07:50 EST 2003


On Thu, 20 Nov 2003 09:25:40 +0000
RI Dunfey <s0231134 at sms.ed.ac.uk> wrote:

> 
> 
> Hi,
> 
> I am looking for simple example of populating a drop down list box
> with records from a table of possible answers.  Does anybody know the
> location of a simple example.
> 
> Kind Regards,
> 
This is really not a db question - but here is an example (ZPT syntax).

<select name="operation">
  <option tal:content="request/operation|nothing"></option>
  <div tal:repeat="rd python:container.select_process_operations_sql(
      department=options['department'])">		  
    <option tal:content="rd/operation"></option>
  </div>
</select>

Notes:  the first option is there, is empty on initial presentation.
I always use the same for for error handling, so it is filled with the
most recently stored value of the request.  The div is a call to a ZSQL
method.  I like explicit arguments.  That's really all there is to it.

Jim Penny




More information about the Zope-DB mailing list