Multi-select dropdown - how to set default value to 'all'

I have a multi-select dropdown which displays dynamic values (names of people). For context, the purpose of my mult-select dropdown is to act as a filter on a repeating group. I have a repeating group showing a list of items, and I have set up a filter so that items only show in the repeating group if their ‘name’ is selected in the multi-select dropdown.

The desired functionality is as follows:

  • By default, a value called ‘All’ is selected in the multi-select list. Note: I don’t want every individual name appear in the multi-select dropdown by default, I only want a single value called ‘All’ to appear which represents all the individual names.
  • The user can click on the multi-select dropdown list, and select individual names. If they do this, then ‘All’ should be removed (e.g. if they select an individual name, ‘Bob’, from the dropdown list, I want the new value of the list to be ‘Bob’, not ‘Bob, All’)
  • If the user has selected a name, then I want ‘All’ to be available as an option in the dropdown list, ideally it should be at the top of the list.
  • If the user selects ‘All’, then any other names they had already selected should be replaced by ‘All’.

Any ideas on the best way to achieve this?

The bubble Forum itself has a dropdown list that works similarly to my desired functionality (see screenshot). The Categories list on the main Forum page. However, this is a regular dropdown list (only one item can be selected), whereas I need this to work with a multi-select.

By default: ‘all categories’ is selected

If user selects a specific category, ‘all categories’ becomes a new option which can be selected at the top of the dropdown list:

You could set the state of the page to be a list of names of people on page load then when the drop down input is changed set the state of the page to be the selected drop down items. Then just have a button which would reset the search back to all.

Then you would just have to set your repeating group to search for the names of people that are included in the state of the page.

2 Likes

This topic was automatically closed after 70 days. New replies are no longer allowed.