[Zope] Checkbox and SQL Method

Laurie Nason laurien@tiger.3dem.bioch.bcm.tmc.edu
Thu, 9 Aug 2001 16:46:22 -0500


Hi there,
Not a great expert at this but have a look in the documentation for
<dtml-sqltest ... it puts a formatted WHERE clause into the SQL statement

I think that the useage is as follows....
<dtml-sqltest column="column_name" name="zope_var" type=""
[op="comparison_operator"][multiple] [optional]>
( putting in multiple allows zope_var to contain a list of items )

Therefore - change your checkbox to read:

<input type="checkbox" name="selected_lcn:list" value="<dtml-var index>">

This will produce a list whether they check one or more boxes

hth

Laurie
PS Thanks to KAIVO for the cheat sheet!

-----Original Message-----
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
CHOY,CHARLENE (HP-Boise,ex1)
Sent: Thursday, August 09, 2001 4:25 PM
To: Zope List (E-mail)
Subject: [Zope] Checkbox and SQL Method


Hi,
  I am having trouble parsing a list that I got from a form.  My clients can
select as many check boxes as they wish.  When process the form, the program
needs to be able to display all the information that the clients requested
base on the check boxes.  So far I can only display the information if the
client only select one checkbox.  The program will fail if the clients
select more than one checkbox. I believe the problem was that my sqlmethod
does not recognized the list that has been sent in.
  If I get a list of input values for the argument of my sql method from the
check box, how do I call the sqlmethod to repeatedly display them.  My
sqlmethod only has one argument.

  The following is some of the snippet of my codes.


=============================
sqlmethod: selected_item
=============================
Argument: selected_number

"SELECT * data where
 index = <dtml-sqlvar selected_item type=int>"


****************************************************************************
*******************

=============================
dtml-method: list_selected_item
=============================
<dtml-var standard_html_header>
<form action=selected_item action=post>
<dtml-in lookup_item size=50 start=query_start> //lookup_item is another sql
method
  <dtml-if sequence-start>
       <dtml-comment> there is some more codes here </dtml-comment>
  <table>
  <tr>
          <th>Index</th>
          <th>Checkbox</th>

  </dtml-if sequence-start>

  <tr>
          <td><dtml-var index null=""></td>

          <td><center><input type="checkbox" name="selected_lcn"
value="<dtml-var index>">
              </center></td>
     <dtml-if sequence-end>

   </table>
   <dtml-comment> Some other codes here </dtml-comment>

     </dtml-if sequence-end>

<dtml-else>

  There was no data matching this <dtml-var title_or_id> query.

</dtml-in>
<input type=submit value="Generate Report">
</form>
<dtml-var standard_html_footer>

****************************************************************************
********************

  Thanks in advance for your help.

-Charlene









_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )