[Zope] Calling a zsql with optional fields

Thierry FLORAC tflorac at onf.fr
Tue Oct 19 12:19:11 EDT 2004


  Hi,

I think that I already made this kind of thing working with a simple :


  <dtml-in "findResults(REQUEST.form)">
  ...
  </dtml-in>


(if "findResults" is the name of your ZSQLMethod component...)


Thierry



On Tue, 2004-10-19 at 18:11, Laura McCord wrote:

> Ok. I redesigned my zsql method to be much simpler:
> 
>  select * from host
>  <dtml-sqlgroup where>
>   <dtml-sqltest name="location1" column="site" type="nb" optional>
>    <dtml-or>
>     <dtml-sqltest name="location2" column="site" type="nb" optional>
>    <dtml-or>
>     <dtml-sqltest name="location3" column="site" type="nb" optional>
>    <dtml-and>
>   <dtml-sqlgroup>
>    <dtml-sqltest name="usetype1" column="UseType" type="nb" optional>
>    <dtml-or>
>     <dtml-sqltest name="usetype2" column="UseType" type="nb" optional>
>     <dtml-or>
>      <dtml-sqltest name="usetype3" column="UseType" type="nb" optional>
>    </dtml-sqlgroup>
>   <dtml-and>
>    <dtml-sqltest name="active" column="Active_Inactive" type="int"
> optional>
> </dtml-sqlgroup>
> 
> My form is a combination of checkboxes:
>    <form action="resultsPage">
>     <table>
>     <tr>
>     <td>Select any of the following combinations:</td>
>     </tr>
>     </table>
>     <table>
>     <tr>
>     <td>Active:</td>
>     <td><input type="checkbox" name="active" value="1"
> checked="checked">Active</td>
>     </tr>
>     <tr>
>     <td>Site:</td>
>     <td><input type="checkbox" name="location1" value="aus">Austin </td>
>     <td><input type="checkbox" name="location2"
> value="ca">California</td>
>     <td><input type="checkbox" name="location3"
> value="mass">Massachusetts</td>    
>     </tr>
>     <tr>
>     <td>UseType:</td>
>     <td><input type="checkbox" name="usetype1"
> value="server">Server</td>
>     <td><input type="checkbox" name="usetype2" value="cad"> CAD</td>
>     <td><input type="checkbox" name="usetype3" value="base">Base</td>
>     </tr> 
>     <tr>
>     <td><span><input type="submit" class="submitLink"
> value="save"></span></td>
>     </tr>
>     </table>
>    </form>
> 
> The only problem I am having is bridging the two in order to get my
> results. I have a dtml method that I am trying to process the zsql
> method but I don't think I am doing it correctly.
> 
> <dtml-call expr="findResults(location1=location1, ...,
> usetype1=usetype1, ...,active=active)">
> 
>  But, with the above if location2 or any of the boxes are not selected I
> am getting an error that they are not defined. How do I correct this
> problem?
> 
> Thanks You.
> _______________________________________________
> 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 )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20041019/e60a1dbd/attachment.htm


More information about the Zope mailing list