[Zope] ZPT/ZSQL optional where problems
J Cameron Cooper
jccooper@jcameroncooper.com
Tue, 29 Jul 2003 17:21:28 -0500
>
>
>It doesnt seem to work and just returns all cats and
>dogs instead of doing the correct filters.
>
>Below is the form and sql method..i cant see whats
>wrong.
>
>ZPT: index_html
>--------------
><FORM name="form1" method="post" action="index_html">
> <SELECT name="cat">
> <OPTION>Select a cat</OPTION>
> <OPTION tal:repeat="cat
>here/animalBrowseMethod"><SPAN
>tal:replace="animal/cat">cat</SPAN></OPTION>
> </SELECT>
> <SELECT name="dog">
> <OPTION>Select a dog</OPTION>
> <OPTION tal:repeat="dog
>here/animalBrowseMethod"> <SPAN
>tal:replace="animal/dog">dog</SPAN></OPTION>
> </SELECT>
> <INPUT type="submit" name="submit" value="Get
>animals">
></FORM>
>---------------
>ZSQL: animalBrowseMethod
>--------------------
>select * from animal
><dtml-sqlgroup optional where>
><dtml-sqlgroup>
><dtml-sqltest cat column=cat type=nb multiple
>optional>
><dtml-or>
><dtml-sqltest dog column=dog type=nb multiple
>optional>
></dtml-sqlgroup>
></dtml-sqlgroup>
>----------------
>
>
ZPT doesn't supply parameters automatically. (Right? I'm pretty sure.)
Do it yourself:
tal:repeat="cat python:here.animalBrowseMethod(cat=request.cat)"
Alternately, you can probably exploit the DTML in the ZSQLMethod:
tal:repeat="cat python:here.animalBrowseMethod(REQUEST=request)"
(This is how it works when called from DTML.)
--jcc