[Zope] Passing information from a form to an SQL method
via a DTML methodd
chas
panda@skinnyhippo.com
Tue, 28 Sep 1999 00:33:13 +0800
I think the real problem was due to passing from DTML document
to DTML method to ZSQL method. The variables suddenly disappear
from REQUEST.
DTML document direct to ZSQL method works fine, as you describe
very well below.
chas
>OK, I'll give you an example.
>
>DTML Document called doc_dtml, has a form with three fields called a,b,c
>respectively.
>
><!--#var standard_html_header-->
><form action="act_dtml">
><table>
><tr><th align=left>A</th><td><input type=text name=a></td></tr>
><tr><th align=left>B</th><td><input type=text name=b></td></tr>
><tr><th align=left>C</th><td><input type=text name=c></td></tr>
><tr><td></td><td><input type=submit></td></tr>
></table>
></form>
><!--#var standard_html_footer-->
>
>DTML Document called act_dtml which calls a SQL Method to update/insert a
>database.
>
><!--#var standard_html_header-->
><dtml-call "dbupdate(a=a,b=b,c=c)">
>Thank you for you interest.
><!--#var standard_html_footer-->
>
>SQL Method called dbupdate (you are better off setting the parameters entry
>box to 'a:string b:string c:string')
>
>insert into test values(
><dtml-sqlvar a type=string>,
><dtml-sqlvar b type=string>,
><dtml-sqlvar c type=string>)
>
>Once you run these three objects starting with doc_dtml you will have
>updated your db.
>
>HTH
>
>Phil
>phil@philh.org
>
>
>-----Original Message-----
>From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Peter
>Whysall
>Sent: Monday, September 27, 1999 2:01 PM
>To: 'zope@zope.org'
>Subject: [Zope] Passing information from a form to an SQL method via a
>DTML methodd
>
>
>I'm getting stuck with this.
>
>I have a DTML document, doc.dtml, with a form whose action, act.dtml, tells
>the user "thank you very much, please call again" and runs an SQL method,
>new.sql, which inserts data from fields a,b,c (from doc.dtml) into the MySQL
>database.
>
>Obviously it's not working, else I wouldn't be writing this :)
>
>What I want to know is this: how do I perform the following tasks (I've had
>a look in the DTML user's guide and can't find anything to help me):
>
>1. Pass data as an attribute/property/parameter from a DTML document to a
>DTML method and hence to a ZSQL method. Do I need to set up some variables,
>populate them with my data, and pass them to the DTML method which then
>passes them to the SQL method?
>2. Glean data from a query and pass that too (example. We know who the
>logged in user is, via AUTHENTICATED_USER.name; this is a key in the USERS
>table in the database and I want to look up the user_id and insert that, not
>the textual name)
>3. Pass the current date/time; I can get it, like this: <dtml-var ZopeTime
>fmt="rfc822">. How do I squizz this along to the query?
>
>Alternatively, am I completely missing the point here?
>
>Many thanks in advance
>
>Peter.
>
>_______________________________________________
>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 )
>
>
>_______________________________________________
>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 )
>
>