Hello, I am looking to search a SQL database for variables that may have been passed by a webform. Basically, when a user submits a userform, there are checkboxes that can or cannot be checked, and I would like to check the results back for the existance of these variables against the SQL database. An example would be... <dtml-in sql_method_that_returns_all_values> <dtml-if <dtml-var important_column_that_may_exist_also_as_a_passed_variable> > Yes, this was passed. <dtml-else> No, it wasn't passed </dtml-if> This is the logic that I am seeking, but I get a syntax error every time I try this. Does anyone out there have any suggestions? Jason
On Sun, 2 Dec 2001, Kyroraz wrote:
I am looking to search a SQL database for variables that may have been passed by a webform. Basically, when a user submits a userform, there are checkboxes that can or cannot be checked, and I would like to check the results back for the existance of these variables against the SQL database. An example would be...
<dtml-in sql_method_that_returns_all_values> <dtml-if <dtml-var important_column_that_may_exist_also_as_a_passed_variable> > Yes, this was passed. <dtml-else> No, it wasn't passed </dtml-if>
Hi Jason, You're not allowed to nest DMTL tags. You can often get around the problem using <dtml-let). There are some How-Tos available that explain how to use dtml-let. I think you'll be much happier using a <dtml-sqlgroup> tag. That will automatically include only those fields in the query that had some value. Check Ch. 10 in the Zope Book for more details. (http://www.zope.org/Members/michel/ZB/RelationalDatabases.dtml) -Tim -- Tim Wilson | Visit Sibley online: | Check out: Henry Sibley HS | http://www.isd197.org | http://www.zope.com W. St. Paul, MN | | http://slashdot.org wilson@visi.com | <dtml-var pithy_quote> | http://linux.com
participants (2)
-
Kyroraz -
Timothy Wilson