faqts : Computers : 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?

Aug 24th, 2000 20:34
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>
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