combining form variables and URL values
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 On that page 'UID' and 'skin' are available to dtml-var. I have a form on that page that take 2 additional input fields from the user(using formulator if that matters). 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. I think the solution would be to make some hidden fields in the form and set their values according to the values on 'UID' and 'skin'. Then once the form results are passed through the validator all 4 values will be available to the zsql method. Is this the most direct way to accomplish this goal?
On Tue, 10 Jun 2003 15:41:41 -0400 GMT (..21:41 where i live(GMT+2) ) jwsacksteder@ramprecision.com asked the Zope mailinglist about the following:
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
On that page 'UID' and 'skin' are available to dtml-var. I have a form on that page that take 2 additional input fields from the user(using formulator if that matters). 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.
I think the solution would be to make some hidden fields in the form and set their values according to the values on 'UID' and 'skin'. Then once the form results are passed through the validator all 4 values will be available to the zsql method.
Is this the most direct way to accomplish this goal?
For a set of only two 'pages' this would be the simplest and most straightforward solution, and it works just fine the way you described it. For more complex situations, look into using sessions. ( http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/Sessions.stx ) :) -- Geir Bækholt
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
Dylan Reinhardt wrote:
<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>>
Those last two lines should read: <input type="hidden" name="UID" value="&dtml-UID;" /> <input type="hidden" name="skin" value="&dtml-skin;" /> When giving examples, I find it best to refrain from introducting blatant cross site scripting holes. -- Jamie Heilman http://audible.transient.net/~jamie/ "You came all this way, without saying squat, and now you're trying to tell me a '56 Chevy can beat a '47 Buick in a dead quarter mile? I liked you better when you weren't saying squat kid." -Buddy
On Tue, 2003-06-10 at 15:14, Jamie Heilman wrote:
Those last two lines should read:
<input type="hidden" name="UID" value="&dtml-UID;" /> <input type="hidden" name="skin" value="&dtml-skin;" />
When giving examples, I find it best to refrain from introducting blatant cross site scripting holes.
A very good point. I still use the regular syntax out of habit, and the reminder is appreciated. :-) Dylan
participants (4)
-
Dylan Reinhardt -
Geir Bækholt -
Jamie Heilman -
jwsacksteder@ramprecision.com