[Zope] Forms with Zope

Michel Pelletier michel@digicool.com
Tue, 27 Jul 1999 10:15:51 -0400


> -----Original Message-----
> From: Cyril Elkaim [mailto:cyril@microform.fr]
> Sent: Tuesday, July 27, 1999 10:04 AM
> To: Zope Mailing List (E-mail)
> Subject: [Zope] Forms with Zope
> 
> 
> 	Hi all,
> 
> 
> 	I'm a complete newbie with Zope. I've installed the 
> beast and it works
> great. I would like to know if it is possible to create a 'classical'
> database application with forms. 
> 
> 	The goal is to have the app accessing a database that 
> the users will
> fill as the information come in.

Sure this is very easy in Zope.

You will need a database, and the apropriate Zope Database Adapter.

Create a Database Connection and type in a valid connection string which
connects you to your database.

Create a DTML method 'input' with your form in it, with the form action
pointing to another DTML Method 'output' ie: <form action="output">.
Let's say one of your form elements is named 'name' ie: <input
type="textbox" name="name">.

Create a ZSQL Method called 'insertName' with one argument, 'name' and
containing SQL code that inserts this value into the database.
something like:

INSERT INTO my_table_with_one_column_called_name
  name VALUES (<!--#sqlvar name-->)

Now create the 'output' DTML method to contain:

<!--#standard_html_header-->
<!--#call insertName-->
Thanks for the input!
<!--#standard_html_footer-->

Now, when a user goes to 'input' and fills in the form, the form will
'action' to output, which will call the ZSQL method 'inserName' which
will insert the name into the database, and then the 'output' DTML
method will say something nice, and that's it.

-Michel




> 
> 	Is there is a tutorial to do such a thing?
> 
> 	Thanks in advance,
> 	Cyril Elkaim
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://www.zope.org/mailman/listinfo/zope
> 
> (To receive general Zope announcements, see:
> http://www.zope.org/mailman/listinfo/zope-announce
> 
> For developer-specific issues, zope-dev@zope.org -
> http://www.zope.org/mailman/listinfo/zope-dev )
>