[Zope-DB] How do I use my archetypes-generated form to insert
datainto a mysql table?
Jonathan
dev101 at magma.ca
Mon Oct 16 08:27:53 EDT 2006
----- Original Message -----
From: "Anna Falkowska" <afalkows at umich.edu>
To: <zope-db at zope.org>
Sent: Monday, October 16, 2006 8:13 AM
Subject: [Zope-DB] How do I use my archetypes-generated form to insert
datainto a mysql table?
>I made a form using ArchGenXML and want to use it to populate a table
> in a mysql database. So far I have not come across a good tutorial on
> how to do this. Someone suggested I use ZSQL methods. I understand how
> to create them, but how exactly would I call a ZSQL method with the
> information from my form?
You can use a python script or external method (or even a dtml method) to
access the form data and make the call to the zsql method. Here is an
example I have pulled from an external method:
rStat=self.Users.SQL_SearchUsers(UID=self.REQUEST['userId'])
if not rStat.dictionaries():
# no user account, log error, error return
SysEventsLogger(self, ....)
return (RFAIL, 0)
# here if we found some user record data, so build the return dictionary
dictList = rStat.dictionaries()
...
In the above example, 'userId' is a form field.
hth
Jonathan
More information about the Zope-DB
mailing list