[Zope] combining form variables and URL values

Dylan Reinhardt zope@dylanreinhardt.com
10 Jun 2003 15:28:19 -0700


On Tue, 2003-06-10 at 12:41, jwsacksteder@ramprecision.com wrote:
> I'm quite sure how I should be thinking about this.
> 
> I  have a page creates a report based on parameters that are in the URL.
> This is important because the user must be able to bookmark the location
> with the parameters included. For the sake of this example let's say the url
> looks like this-
> http://www.myserver.com/news/index_html?UID=11234;skin=modern

You may want to re-write that querystring as

?UID=11234&skin=modern


> 
> I need to then pass all four values into a dtml method for
> validation, then into a zsql method. Unfortunately 'UID' and 'skin' are only
> in the namespace of the initial page, thus this doesn't work. 

To re-state, you have two dtml methods, my_report and my_report_maker. 
The user calls my_report with arguments, specifies additional data in a
form and my_report_maker does the heavy lifting.

Use something like this for my_report:

-------

<dtml-if form_submitted>
    <dtml-var "my_report_maker(REQUEST)">
<dtml-else>
    <form method=post action=my_report>
    <input type=hidden name=form_submitted value=1>
    <input type=hidden name=UID value=<dtml-var UID>>
    <input type=hidden name=skin value=<dtml-var skin>>

    Other Variable A <input type=text name=other_a><BR>
    Other Variable B <input type=text name=other_b><BR>

    <input type=submit value="Create Report">
    </form>
</dtml-if>

-------

Now my_report_maker will have use of all required names and users will
be able to bookmark the intermediate step where they had two of the four
arguments defined.

HTH,

Dylan