Faqts : Business : Internet : Web Servers : Zope : Common Problems

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

8 of 10 people (80%) answered Yes
Recently 5 of 7 people (71%) answered Yes

Entry

How do I process form variables?

Oct 17th, 2009 06:16
adel85 adel85, unknown unknown, Janko Hauser


Problem:

that is, if I have a html having some form variables and a submit
button. I click on the submit button. it should call some 
script..right?
My question is how to pass values from one script to another. how is
this done in Zope?

Solution:

It's simple there :-)

place the following code as a DTML-document with name "form_doc" in 
some folder.

<dtml-var standard_html_header>
<h2>A small form example</h2>
<p>
Ask a simple question here and call a DTML method which shows the 
answer.
</p>

<form action="show_res">
   <input name="tval" type="text" maxlength="20" width="20">
   <input type="submit" value="send">
</form>

<dtml-var standard_html_footer>

And the following in a DTML-method with name show_res.

<dtml-var standard_html_header>
<h2>Shows the result from the form_doc</h2>
<p>
The value of the form variable <tt>tval</tt> is <br>
<dtml-var tval>
</p>
<dtml-var standard_html_footer>
http://www.borsaat.com/vb/f2/
http://www.borsaat.com/vb/f4/
http://www.borsaat.com/vb/f8/
http://www.borsaat.com/vb/f14/
http://www.borsaat.com/vb/f28/
http://www.borsaat.com/vb/f30/
http://www.borsaat.com/vb/f10/
http://www.borsaat.com/vb/f11/
http://www.borsaat.com/vb/f12/
http://www.borsaat.com/vb/f13/
http://www.borsaat.com/vb/f6/
http://www.borsaat.com/vb/f64/
http://www.borsaat.com/vb/f38/
http://www.borsaat.com/vb/f41/
http://www.borsaat.com/vb/f44/
http://www.borsaat.com/vb/f56/
http://www.borsaat.com/vb/f45/
http://www.borsaat.com/vb/f65/
http://www.borsaat.com/vb/f57/
http://www.borsaat.com/vb/f23/
http://www.borsaat.com/vb/f54/
http://www.borsaat.com/vb/f22/
http://www.borsaat.com/vb/f55/
http://www.borsaat.com/vb/f43/
http://www.borsaat.com/vb/f66/
http://www.borsaat.com/vb/f67/
http://www.borsaat.com/vb/f69/
http://www.borsaat.com/vb/f42/
http://www.borsaat.com/vb/f68/
http://www.borsaat.com/vb/f70/
http://www.borsaat.com/vb/f26/
http://www.borsaat.com/vb/
http://www.borsaat.com/vb/f90/
So the form values become members of the namespace of the called
method. There is a huge amount of documentation in the howtos and the
guides at www.zope.org or zdp.zope.org