I am collecting form data in a :records object: <form action="page2"> <input type=text name="stuff.name:records:string" value="" > <input type=text name="stuff.snumber:records:int" value="" > <input type="submit" value="Submit"> </form> 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). Any ideas?
I am collecting form data in a :records object:
<form action="page2"> <input type=text name="stuff.name:records:string" value="" > <input type=text name="stuff.snumber:records:int" value="" > <input type="submit" value="Submit"> </form>
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).
Any ideas?
You probably have to use whatever construct you usually use for iterating over/accessing a 'record' (probably dictionary methods) to create separate hidden fields for the records. Probably your second form needs to render like: <input type="hidden" name="stuff.name:records:string" value="thisName" > <input type="hidden" name="stuff.snumber:records:int" value="234" > If you don't mind hardcoding in the fields, it becomes a lot easier, since you don't have to do a lot of introspection on the record. May be that's a bit confusing. Better explication on request. --jcc
Erik Myllymaki wrote at 2003-5-14 13:24 -0700:
I am collecting form data in a :records object:
<form action="page2"> <input type=text name="stuff.name:records:string" value="" > <input type=text name="stuff.snumber:records:int" value="" > <input type="submit" value="Submit"> </form>
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).
Any ideas?
You might consider using a session object to pass complex data between requests. Please read the Zope Book. Dieter
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
participants (4)
-
Dieter Maurer -
Erik Myllymaki -
Evan Simpson -
J Cameron Cooper