[Zope] Question involving passing optional parameters to a zsqlmethod

Alexis Roda alexis.roda at urv.es
Tue Oct 19 12:20:39 EDT 2004


Laura McCord wrote:
> I have a form with 7 checkboxes. The more checkboxes are selected the
> more narrow of results you will get. I created a zsql method that will
> handle every case as far as when to include 'AND','OR', and '()'. 
> 
> The problem now is getting my form to execute the zsql method correctly.
> When I hit the submit button the boxes that are not check will trigger
> an error message stating that the variable was not defined.

That's "ok", nothing is submitted for checkboxes that are not checked, 
so ZPublisher does not add the name to the REQUEST, so the function call 
complains about undefined variables.

> I am trying to figure out when I hit the submit button my dtml method
> that runs the zsql method is not written to adjust for empty parameters.
> I had originally called my function like this:
>  <dtml-call expr="findResults(location1=location1, location2=location2,
> ..., usetype1=usetype1, usetype2=usetype2,...,active=active)">
> 
> Does anyone have an idea on how to call this function regardless of what
> boxes are checked?

provide default values for missing parameters (either in the function 
definition or in the form) or write the function in such a way that can 
handle missing parameters (perhaps testing REQUEST.has_key('check1')).



HTH
-- 
                                    ////
                                   (@ @)
----------------------------oOO----(_)----OOo--------------------------
<>               Ojo por ojo y el mundo acabara ciego
/\ Alexis Roda - Universitat Rovira i Virgili - Reus, Tarragona (Spain)
-----------------------------------------------------------------------



More information about the Zope mailing list