[Zope] ZPT/ZSQL optional where problems

Wayne Connolly wayne@c-media.com.au
Tue, 29 Jul 2003 20:11:31 -0700 (PDT)


Oh it was too simple... thanks JCC. after I did as you
suggested i realised my other mistakes...Thanks very
much.



--- J Cameron Cooper <jccooper@jcameroncooper.com>
wrote:
> >
> >
> >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
> 
> 
> 
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com