Easy and hard answer.

The easy answer is forget what you know about scripts/cgi and pulling in
form variables from some sort of CGI method (perl module). Since Zope is a
constant running process it does not require that you point to a script.

Hard Answer: The basics are that all you have to do is give the form element
a name (as you would in any form) and point the action of the form to
another DTML Method/Document. In that M/D all you have to do to get the
variable is call it with <DTML-VAR variable_name>

1) Create a form page with 'submit' with one text input box with a name of
'email_address'.

2) Point the action to a method called 'result' and create that

3) In the 'result' method include this code <dtml-var email_address>

4) Play around.

When you submit from one you should be taken to the second page and the
email_address should be there.

Now, for validation you can do all sorts of tricky things. I happen to like
to have the form point back to itself and have one method handle the entire
activity. You can validate things by asking for them, or trying to do
something else like put them into a database/email. If they are not there
you will get an error so you can use <dtml-try>. What makes Zope great is
that I can have the form and function in the same page (easier to
update/check).

Examples: (these are live and in production so please be kind)

http://fundraising.gotschool.com/tell_a_friend.html

http://market.gotschool.com/  (click on register for either school or
supplier and notice how the form is different for both).

Same thing done twice.

J

> From: Amit Redij <[EMAIL PROTECTED]>
> Date: Mon, 28 Aug 2000 17:15:03 +0530
> To: [EMAIL PROTECTED]
> Subject: [Zope] Newbie question: FORM processing in Zope.
> 
> 
> hi,
> 
> I am a Perl/CGI programmer, trying out Zope.
> I am confused right now about
> HOW TO process FORM variables?
> and most important thing is
> how to validate form inputs.(like same thing is best done in PERL using
> regex)
> 
> 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?
> 
> thanks a lot in advance.
> 
> regards
> Amit
> 
> ----------------------------------------
> .--.
> |o_o |
> |\_/ |
> //   \ \    Amit Redij
> (|     | )   mailto:[EMAIL PROTECTED]
> /'\_   _/`\   
> \___)=(___/ 
> ----------------------------------------
> 
> _______________________________________________
> Zope maillist  -  [EMAIL PROTECTED]
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )
> 
> 


_______________________________________________
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to