[Zope] Multiple Selection with "Checkboxes":
Arno Gross
zope@consotec.de
Wed, 25 Jul 2001 10:59:12 -0100
You can try:
<dtml-in List_available_items>
<input type=checkbox name=ap_selection:list value="<dtml-var "_['sequence-item']">"
<dtml-if expr="_['sequence-item'] in List_selected_items">
checked (<dtml-var "_['sequence-item']">)
</dtml-if>
>
<dtml-var sequence-item><br>
</dtml-in>
You have a list and you must ask for membership (with 'in'), also you can save
one <dtml-in>.
Best regards
Arno
>On Wed, 25 Jul 2001, Richard Bendit wrote:
> 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
>
>
> _______________________________________________
> 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 )