Re: [Zope] Newbie question: FORM processing in Zope.

2000-08-28 Thread Loren Stafford



A great resource for newbies is the collection of How-To's
http://www.zope.org/Documentation/How-To (or better yet:
http://www.zope.org/Members/AlexR/tips/howto_list where you can use browser
search to find what you need).

Search for "forms" and you will see, for example:

http://www.zope.org/Members/jules/smarterforms_html

In short, the methods of Zope objects are all "CGI scripts". For the
"action" of a form, you supply the url of a form-handling method of some
Zope object you have created. When that method runs, form fields are stored
in the dictionary (hash, to you) that implements the namespace for the
request. You access them as simple DTML variables: e.g.



If you want to send the value of that form field on to another form, you do
it much the same as in Perl -- you code a hidden form field and assign it
the value .

-- Hope that helps
-- Loren

- Original Message -
From: "Amit Redij" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: August 28, 2000 04:45 AM
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 )




Re: [Zope] Newbie question: FORM processing in Zope.

2000-08-28 Thread J. Atwood

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 

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 

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 . 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 )




[Zope] Newbie question: FORM processing in Zope.

2000-08-27 Thread Amit Redij


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 )