Hi everyone, I've got Ross's PostgreSQL DA installed and working. Now I'm working on creating a form so I can insert records into the database through the Web. The ZSQL method tests out perfectly, I just need a form. The Z Search Interface wizard works great for generating forms to retrieve data, I just wish there was one to generate forms for putting data in. I thought I could cheat by looking at the HTML for the SQL test form. Here's what I get in the <form> portion (qry_insert_alum is my ZSQL method): <form action="http://www.mysite.foo/qry_insert_alum/manage_test" method="get"> I doubt that 'manage_test' is really the action that I want. What should be there? -Tim -- Timothy Wilson | "The faster you | Check out: Henry Sibley H.S. | go, the shorter | http://slashdot.org/ W. St. Paul, MN, USA | you are." | http://linux.com/ wilson@visi.com | -Einstein | http://www.mn-linux.org/
Hi Tim, You can just "call" the method: Here is a ZSQL method: insert into customers (cust_id, company_name, address1, address2, city, state, zip, phone, contact_name, contact_email) values ( NULL, <!--#sqlvar company_name type=string-->, <!--#sqlvar address1 type=string-->, <!--#sqlvar address2 type=string-->, <!--#sqlvar city type=string-->, <!--#sqlvar state type=string-->, <!--#sqlvar zip type=string-->, <!--#sqlvar phone type=string-->, <!--#sqlvar contact_name type=string-->, <!--#sqlvar contact_email type=string--> ) and here is the DTML to use it to add a customer.... <!--#var standard_html_header--> <!-- bare bones.. let's get the data in there... --> <!--#call "insertCustomer(company_name=company_name, address1 = company_address1, address2 = company_address2, city = company_city, state = company_state, zip = company_zip, phone = main_phone, contact_name = contact_name, contact_email = contact_email)"--> <center> <table width=80%> <tr><td><h2>Thanks! We have captured your information. We'll be contacting you at &dtml-contact_email;.</h2> </td></tr> </table> </center> <!--#var standard_html_footer--> -steve
"Tim" == Timothy Wilson <wilson@visi.com> writes:
Tim> Hi everyone, Tim> I've got Ross's PostgreSQL DA installed and working. Now I'm Tim> working on creating a form so I can insert records into the Tim> database through the Web. The ZSQL method tests out Tim> perfectly, I just need a form. The Z Search Interface wizard Tim> works great for generating forms to retrieve data, I just Tim> wish there was one to generate forms for putting data in. Tim> I thought I could cheat by looking at the HTML for the SQL Tim> test form. Here's what I get in the <form> portion Tim> (qry_insert_alum is my ZSQL method): Tim> <form Tim> action="http://www.mysite.foo/qry_insert_alum/manage_test" Tim> method="get"> Tim> I doubt that 'manage_test' is really the action that I Tim> want. What should be there? Tim> -Tim Tim> -- Timothy Wilson | "The faster you | Check out: Henry Sibley Tim> H.S. | go, the shorter | http://slashdot.org/ W. St. Paul, Tim> MN, USA | you are." | http://linux.com/ wilson@visi.com | Tim> -Einstein | http://www.mn-linux.org/ Tim> _______________________________________________ Zope maillist Tim> - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope Tim> ** No cross posts or HTML encoding! ** (Related lists - Tim> http://lists.zope.org/mailman/listinfo/zope-announce Tim> http://lists.zope.org/mailman/listinfo/zope-dev )
Steve Spicklemire wrote:
....
and here is the DTML to use it to add a customer....
<!--#var standard_html_header--> <!-- bare bones.. let's get the data in there... -->
<!--#call "insertCustomer(company_name=company_name, address1 = company_address1, address2 = company_address2, city = company_city, state = company_state, zip = company_zip, phone = main_phone, contact_name = contact_name, contact_email = contact_email)"-->
If you are just inserting the values from REQUEST, you don't even need all the xxx=xxx arguments, as ZSQLMethods can get them from REQUEST automatically. They must however be defined in the arguments part of SQL method. -------------- Hannu
participants (3)
-
Hannu Krosing -
Steve Spicklemire -
Timothy Wilson