[Zope] dtml-if question
Timothy Wilson
wilson@visi.com
Mon, 3 Dec 2001 06:43:37 -0600 (CST)
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