Remove item from multiselect field

Remove item from multiselect field

My basic issue is that I would like to be able to remove an element from a multiselect field (i.e. the inverse of ui.add...like ui.remove, which doesn't exist).  Here's the set-up.

I have a "unattached" form with a search function that lets the user add items to a multiselect field one at a time. (search, select the desired item, that adds it to a multi select field by ui.add:, and all items in the multiselect field are selected).  That all works very nicely.

I would like to add the ability to select a single or multiple elements in the multiselect field and remove them.  Deselecting it isn't an option for this situation - the user may have 20 items selected and it will be easier for them to just select the one they want to remove).  The user needs to be able to click on an item, click somewhere else, and have that one item disappear from the multiselect and all the others be selected.

I have tried two things, one is a user button, but certain options (like ui.add) aren't allowed.  So I am trying to work with a checkbox and onuserinput script. I would like the user to select an item in the multiselect field, and then click the checkbox below.  The on user input script for that checkbox should perform what I need.  Since there isn't a ui.remove option, I've tried this strategy:
1. Create a list containing the item I want to remove from the multiselect
2. Select all items in the multiselect
3. Create a second list containing all the items
4. Use removeElement to remove the first list from the second list
5. Clear the multiselect and ui.add the new modified list
6. Select all in the multiselect, and clear the checkbox

The problem is that the select all function (to create the list of all the elements in the multiselect, not just the one the user selected) seems to run at the end, so that the second list only contains the one selected item I want to remove.  I've tried debugging using alert boxes, and if I use "alert second_list" it's the same as "alert first_list".  

Any other workarounds?
    Zoho Desk Resources

    • Desk Community Learning Series


    • Digest


    • Functions


    • Meetups


    • Kbase


    • Resources


    • Glossary


    • Desk Marketplace


    • MVP Corner


    • Word of the Day


      Zoho CRM Plus Resources

        Zoho Books Resources


          Zoho Subscriptions Resources

            Zoho Projects Resources


              Zoho Sprints Resources


                Zoho Orchestly Resources


                  Zoho Creator Resources


                    Zoho WorkDrive Resources



                      Zoho Campaigns Resources

                        Zoho CRM Resources

                        • CRM Community Learning Series

                          CRM Community Learning Series


                        • Tips

                          Tips

                        • Functions

                          Functions

                        • Meetups

                          Meetups

                        • Kbase

                          Kbase

                        • Resources

                          Resources

                        • Digest

                          Digest

                        • CRM Marketplace

                          CRM Marketplace

                        • MVP Corner

                          MVP Corner




                          Zoho Writer Writer

                          Get Started. Write Away!

                          Writer is a powerful online word processor, designed for collaborative work.

                            Zoho CRM コンテンツ




                              ご検討中の方