[Zope] Creating a List from a SQLMethod

Phil Harris phil.harris@zope.co.uk
Mon, 3 Jan 2000 23:10:44 -0000


How about something like (untested)

<select name="Category"> 
<option>(None)>
<dtml-call "REQUEST.set('catlist',[])">
<dtml-in CategorySelectQuery start=query_start>
<option><dtml-var category>
<dtml-call "catlist.append(category))">
</dtml-in>
</select>

Phil
phil.harris@zope.co.uk



----- Original Message ----- 
From: "Timothy Grant" <tjg@avalongroup.net>
To: "Zope Folk" <zope@zope.org>
Sent: Monday, January 03, 2000 12:34 PM
Subject: [Zope] Creating a List from a SQLMethod


> Hi,
> 
> I've got a page that displays a <select> list based on the return values
> from a SQLMethod. It works exactly as expected.
> 
> I have now determined a need to display the exact same <select> multiple
> times on the same page.
> 
> The original code to build the select list looks something like this:
> 
> <select name="Category">
> <option>(None)
> <dtml-in CategorySelectQuery start=query_start>
> <option><dtml-var category>
> </dtml-in>
> </select>
> 
> I thought I could do something like the following:
> <select name="Category">
> <option>(None)
> <dtml-in CategorySelectQuery start=query_start>
> <option><dtml-var category>
> <dtml-call "REQUEST.set('catlist:list', category)">
> </dtml-in>
> </select>
> 
> And then later on the page do this
> 
> <select name="category">
> <dtml-in catlist>
> <option><dtml-var "_['sequence-item']">
> </dtml-in>
> </select>
> 
> Unfortunately Zope returns a Key error on catlist.
> 
> What am I doing wrong?
> 
> Thanks.
> 
> 
> 
> -- 
> Stand Fast,
>     tjg.
> 
> Chief Technology Officer              tjg@exceptionalminds.com
> Red Hat Certified Engineer            www.exceptionalminds.com
> Avalon Technology Group, Inc.                   (503) 246-3630
> >>>>>>>>>>>>EXCEPTIONAL MINDS, INNOVATIVE PRODUCTS<<<<<<<<<<<<
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>