[Zope] Re: passing :records on in a hidden field

Evan Simpson evan@4-am.com
Fri, 16 May 2003 09:11:48 -0500


Erik Myllymaki wrote:
> On page2, I have another form that I am collecting data in, and would then
> like to pass both records objects on to page3, but a  simple <input
> type="hidden" name=stuff value=<dtml-var stuff> > doesn't work (it passes a
> string that represents the records).

If you decide to pursue this approach, rather than sessions, you should 
look at the follow ZTUtils function:

def make_hidden_input(*args, **kwargs):
     '''Construct a set of hidden input elements, with marshalling
     markup.

     If there are positional arguments, they must be dictionaries.
     They are combined with the dictionary of keyword arguments to form
     a dictionary of query names and values.

     Query names (the keys) must be strings.  Values may be strings,
     integers, floats, or DateTimes, and they may also be lists or
     namespaces containing these types.  All arguments are marshalled
     with complex_marshal().
     '''

Note that while this function will not accept a record object directly, 
you can make a dictionary from the record by using its .copy() method.

Cheers,

Evan @ 4-am