-----Original Message----- From: Timothy Grant [mailto:tjg@avalongroup.net] Sent: Tuesday, September 07, 1999 5:19 PM To: Kevin Dangoor; Zope Folk Subject: Re: [Zope] Building a list programmatically under DTML
<ul> <dtml-in desc> <li><dtml-var sequence-item></li> </dtml-in> </ul>
Unfortunately, neither the above, nor any other kinds of list making, paragraph making or line breaking give me what I expect. The about I get is always in "list" format
['item 1', 'this is item 2', 'I am the third item in the list']
So, I *know* its a list, why won't the "in" tag work, do I have to do some sort of name space tweaking?
Also, I should pass along that the list is passed to the form using the following html snippet
<input type="hidden" name="desc:list" value="<dtml-var desc>">
A Ha! This will pass the *string* '['item 1', 'this is item 2', 'I am the third item in the list']' as *one item in a list*. You cannot pass along python objects through HTML <input> elements, they are just too simple. All they can provide is a mapping between a name and a string value. To do so, you would need to _build_ your hidden input fields: <form action...> <dtml-in desc> <input type="hidden" name="desc:list" value="<dtml-var sequence-item>"> </dtml-in> </form> This will put an <input...> in your HTML for every element in the list 'original_list'. When the 'action' of this form gets called, ZPublisher will marshal all of the <input...>s into a list called 'desc'. And then your code will work. -Michel