[Zope] Building a list programmatically under DTML

Evan Simpson evan@4-am.com
Tue, 07 Sep 1999 16:59:54 -0500


Timothy Grant wrote:

> 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>">

Aha! The hidden clue!  This doesn't do what you expect.  It creates a list
containing a single item: the string representation '[...,...,...]' of desc.

You want either

<dtml-in desc>
  <input type="hidden" name="desc:list" value="&sequence-item;">
</dtml-in>

or

<input type="hidden" name="desc:lines" value="<dtml-var "_.string.join(desc,
'\n')">">

if desc items are guaranteed not to contain newlines, or

<input type="hidden" name="desc:tokens" value="<dtml-var
"_.string.join(desc)">">

if desc items are guaranteed not to contain any whitespace.