Re: How do I use my archetypes-generated form to insert datainto a mysql table?
"Jonathan" <[email protected]>
| Newsgroups | gmane.comp.web.zope.database |
|---|---|
| Message-ID | <000301c6f11e$8120ef50$677ba8c0@DESKTOP> |
----- Original Message ----- From: "Anna Falkowska" <[email protected]> To: <[email protected]> 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