[Zope] Variable setting in 'if' for use outside of 'if'

Amos Latteier amos@aracnet.com
Wed, 10 Feb 1999 18:01:35 -0800


At 04:45 PM 2/10/99 -0800, Timothy Grant wrote:
...
>I was terribly disappointed to
>discover that variables that were assigned in Form One, and were displayed
>in Form Two no longer existed when I got to the form that displayed the
>results.

This is a basic feature of HTTP, it's stateless. Variables are defined in a
given request, but unless you save them in some way they're lost. This
scenario is not Zope-specific. Common solutions to this are:

* storing information in the browser with cookies
* storing information in hidden form elements of returned HTML pages
* storing information on the server in "user sessions" which are keyed to
cookies, or some kind of URL tagging scheme

In your case I suggest using hidden form elements.

For example:

page1:

<form action="page2">
foo: <input type="text"name="foo">
<input type="submit">
</form>

page2:

<form action="page3">
<input type="hidden" name="foo" value="<!--#var foo-->">
bar: <input type="text" name="bar">
<input type="submit">
</form>

page3

foo: <!--#var foo-->
bar: <!--#var bar-->

Hope this helps.

-Amos


--
Amos Latteier             mailto:amos@digicool.com
Digital Creations         http://www.digicool.com/