[Zope] Records marshalling: trying to including a list within a record

Casey Duncan cduncan@kaivo.com
Tue, 13 Mar 2001 08:45:32 -0700


Rich and Lea98 wrote:
> 
> Hi,
> 
> Can anyone give me ideas on solving the following problem...
> 
> Im trying to pass information in a form using :records. One item in
> each record is a list I wish to pass as a list and use <dtml-in bob>
> to display the list contents.
> 
> I have tried all sorts of variations...
> 
>     <input type="hidden" name="my_record.bob:records:list"
> value="<dtml-in bob><dtml-var sequence-item></dtml-in>">
> 
> and...
> 
>     <input type="hidden" name="my_record.bob:list:records"
> value="<dtml-in bob><dtml-var sequence-item></dtml-in>">
> 
> Anything I try just places the whole of "bob" as one item in a list.
> eg
> if bob was ['this ','is ','bob'].
> The list in the record passed using the form would be ['this is bob'].
> 
> Thanks for any ideas in advance.
> 
> Richard
> 

If you want to pass lists in text boxes, use the tokens marshaling and
the
string.join function on the list like so:

<input type="hidden" name="my_record.bob:records:tokens"
       value="<dtml-var expr="_.string.join(bob)" html_quote>">

Tokens will create a list from each word in a string. So a caveat is
that
you cannot have spaces in a list item. To get around this you might try
(untested):

<dtml-in bob>
	<input type="hidden" name="my_records.bob:list:records"
               value="&dtml-sequence-item;">
</dtml-in>

I don't know if combining list and records will work in this context
however.
-- 
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>