RE: [Zope] Building a list programmatically under DTML
-----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
<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.
My thanks to all of you who helped me out with this problem! It is very apparent that acquisition does not happen only within Zope but also among its users. My personal Zope Zen has acquired a couple of fractional percentage points. Once again thanks. -- Stand Fast, tjg. Red Hat Certified Engineer tjg@avalongroup.net Chief Technology Officer www.avalongroup.net Avalon Technology Group, Inc. (503) 246-3630
>>>>>>Exceptional Minds, Innovative Products<<<<<<<<<<<<
participants (2)
-
Michel Pelletier -
Timothy Grant