Thanks Eric (and Neil), passing REQUEST to zsql_method works. Here's what I had to do to get it working: zsql_method gets a parameter named request. Call the query with <dtml-call "zsql_method(request=REQUEST)"> Inside the zsql_method, get the form values out with calls like this: <dtml-sqlvar "request.field_companyname" type=string> or <dtml-sqlvar "request['field_companyname']" type=string> I'm still confused about my confusion. It looks to me like the zsql_method has its own REQUEST and thus doesn't try to find the values in the calling object. I find it odd that I haven't seen any discussion of this issue in any of the books/documentation I've run across. But when acquisition does work inside ZSQL Methods, it's very cool! Thanks for the help! Howard Hansen http://howard.editthispage.com ----- Original Message ----- From: "Eric Walstad" <eric@ericwalstad.com> To: "Howard Hansen" <zope@halfmagic.com> Cc: <zope@zope.org> Sent: Monday, February 18, 2002 10:21 PM Subject: Re: [Zope] Using Form data values in ZSQL Method: I must be missing something here
Hi Howard.
It looks like your ZSQL method is not getting the form data it needs. Like you mentioned, you could pass those parameters explicitly when you call the the ZSQL method, or you could pass the REQUEST object to the ZSQL method:
<dtml-call "zsql_method(companyname=companyname, companyphone=companyphone, etc to the 29th parameter)"> or <dtml-call "zsql_method(REQUEST)"> Hey, you may want to try something like this - It might work and would not have to pass so much stuff to the ZSQL method: <dtml-call "zsql_method(form)">
I'm guessing it's more efficient to pass just the parameters the ZSQL method will need, but it is a pain to pass all 29 of them!
I hope that helps,
Eric.
Howard Hansen wrote:
I'm certain that I'm doing something very silly here, and I've learned many new things about Zope and databases by researching this problem, but I haven't figured out how to make it work.
All I want to do is create forms that allow me to insert or update records in a database.
Here's the structure I've set up:
form: collects the form data, and when the user clicks submit, it calls: action_dtml_method: which calls: zsql_method, which modifies the database and tells the user what just happened
When I hit Submit, I can easily list the values from the form inside the action_dtml_method, but zsql_method acts like it has no clue about the form values. It gives me the error:
Missing input variable, field_companyname