[Zope] Multiple Selection with "Checkboxes":

Richard Bendit rbendit@netbooster.de
Wed, 25 Jul 2001 12:02:33 +0200


What i use is:

1. UpdateForm (DTML-Method)
2. List_available_items (ZSQL-Method)
   "select ap_id,ap_docname from AliasPages where proj_id=<dtml-sqlvar
proj_id type=int>"
3. List_selected_items (ZSQL-Method)
   "select ap_selection from Projects where proj_id=<dtml-sqlvar proj_id
type=int>"

Problem: I want that the Checkboxes are "CHECKED" if "available_items" ==
"selected_items"

I am not sure if my dtml is wrong or the sql-method: ! See the TIP at the
end of this mail !

****************************
Here the: "UpdateForm"
****************************

<dtml-call "REQUEST.set('selectedITEMS',[])">
<dtml-in List_SelectedALIASPAGES>
  <dtml-call "selectedITEMS.append(proj_id)">
</dtml-in>

<dtml-in List_available_items>
      <input type=checkbox name=ap_selection:list value="<dtml-var
sequence-item>"
		<dtml-call expr="REQUEST.set(selectedAP,_['sequence-item'])">
		<dtml-in List_selected_items>
			<dtml-if expr="_['sequence-item'] == selectedITEMS">
				checked
			</dtml-if>>
		</dtml-in>
      <dtml-var sequence-item><br>
</dtml-in>
   </TD>
</TR><dtml-comment>colname:ap_selection,table:Projects</dtml-comment>

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

Here a tip i found:

"How to construct such a query?
If you know, that your values do not contain quotes (i.e. '),
then you can use "_.string.join" like this:

     select ... where
     col in ( <dtml-var "_.string.join(multiple_selection,',')"> )"



I recognized that a lot of USERS have these problems with "Multiple
Selections". So if you will help to find a good way to manage this i will
post a "How-To" in Zope and i wanted to create an ADD-ON for the great
product "ZNolk".



THANX you all for your time.



REGARDS



Richard