[Zope] iterate over ZSQL method and make hidden form values...?

Thomas B. Passin tpassin@mitretek.org
Wed, 6 Mar 2002 14:05:05 -0500


[Erik Myllymaki]

> I have a form that collects about 15 values, and a ZSQL method that
> collects about 15 values on the same page. I want to amalgamate them
> together and push them through to the next page where I could then use
> them all easily in another ZSQL method by just passing REQUEST.
>
> (note, I am using ZODBCDA so zsql_result.dictionaires() is unavailable
> to me!).
>
> Something like this(but that actually works ;-)):
>
> <form>
> <dtml-in zsql_method>
>    <dtml-in sequence-item>
>      <input type="hidden" name="<dtml-var sequence-item-name>"
> value="<dtml-var sequence-item-value"> >
>    </dtml-in>
> </dtml-in>
>
> <many other inputs here................>
> <input type="submit" name="submit" value="go">
> </form>
>
>

This is unclear to me.  If the form has already collected the values, why to
you need to collect them a second time?  And if this zsql_method is acting
correctly, why are you trying to put its returned data into hidden fields in
another form?

You can access the results from the zsql_method in another method the same
as you can access them in a dtml page, so just pass the results to the new
method:

<dtml-let results=zsql_method>
    <dtml-var "second_zsql_method(param=results)">
</dtml-let>

Of course, you have to declare "param" when you define the 2nd zsql method.

Cheers,

Tom P