[Zope] hidden list

Martijn Pieters Martijn Pieters <mj@digicool.com>
Thu, 16 Dec 1999 14:33:24 +0100


Hello Daniel,

Wednesday, December 15, 1999, 11:23:41 PM, you wrote:
DGR> I would like to pass through a list called roles (built from a previous
DGR> screen list box). I tried this:
DGR> <input type='hidden' name='roles:list' value='<!--#var roles-->'>

DGR> but the result is: ['['] 

DGR> It should be: ['resale', 'salesRep']

DGR> I verified that the variable "roles" actually contains ['resale',
DGR> 'salesRep'] 
DGR> by displaying: <dtml-var roles>

DGR> Any thoughts as to what I'm missing?????

If you want to pass along a hidden list proerty, you'll have three
options:

1. Pass it along as a list of hidden fields with the :list modifier,
Zope will reassemble the list:

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

2. Turn the list into a space-seperated token property. This only works if
there are never any spaces in your list items:

  <dtml-let tokens="_.string.join(roles)">
    <input type=hidden name="roles:tokens" value="&dtml-tokens;">
  </dtml-let>

3. Turn the list into a newline-seperated lines property. This only
works if there are never any newlines in your list items:

  <dtml-let lines="_.string.join(roles, '\n')">
    <input type=hidden name="roles:lines" value="&dtml-lines;">
  </dtml-let>


Warning: this is from the top of my head, YMMV.

-- 
Best regards,
 Martijn                            mailto:mj@digicool.com