[Zope] Passing lists through forms

Colyn Brown colynb@msn.com
Mon, 26 Aug 2002 16:55:45 -0700


I've been struggling with trying to pass a list though a form on one page 
(method1) to a another page (method2). Now it sounds pretty straight 
forward, but for some reason I cannot get it to work. Here's what I have for 
method1:

<form action=method2 method=post>
<dtml-call "REQUEST.set('myIDS',[])">

<dtml-in mySQL_query>
<dtml-call "myIDS.append(idFromQuery)">
</dtml-in>

<input TYPE="hidden" name="myIDS:list" value=" <dtml-var myIDS> ">
<input type="Submit" VALUE=" Submit ">

</form>

Then in method2 I just put the REQUEST to see what got passed:

form
myIDS [" ['8', '1', '2', '3', '4', '5', '6', '7'] "]

As you can see, myIDS got turned into a ONE item list that contains a string 
that LOOKS like a list.

What have I missed? I think I remember doing this before with no problems. I 
can't figure out what I'm doing wrong this time.

Oh yeah, I figured out a way to turn that string into a list using 
string.replace to remove the brackets and then string.split on the commas to 
turn it into a workable list. I don't know about any of you, but to me that 
seems like way too much work for something that I know can be done a lot 
simpler.

-------
Colyn Brown

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com