[Zope] Question involving passing optional parameters to a zsql
method
Jim Penny
jpenny at universal-fasteners.com
Tue Oct 19 11:32:51 EDT 2004
On Tue, 19 Oct 2004 10:19:50 -0500
"Laura McCord" <Laura.McCord at doucet-austin.com> 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.
>
> 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?
Suppose you have checkbox with name 'foo'. In your DTML method, before
your ZSQL call, do:
<dtml-call "REQUEST.set('foo', REQUEST.has_key('foo'))>
This will set the variable 'foo' to 0 if the checkbox name is not in the
REQUEST (not checked), and 1 if the the checkbox name is in the request
(checked). This is exactly what you want.
>
> thanks.
> _______________________________________________
> Zope maillist - Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
>
>
More information about the Zope
mailing list