Select All, Send to database

Hello, I am trying to create a select all/ deselect all feature that sends to the database.

I already created the select all/ deselect all feature, but it does not correctly send to the database. Ideally, I would be able to press the select all button and then deselect a couple of options and then send that to the database.

I thought I read somewhere that I need to create an event that adds/ removes each option individually.

Thanks.

Do you want the database to be updated as and when each item is selected/deselected…

Or only once another button has been clicked to confirm the selection?

I have a long form, where the user would fill it out and at the bottom I have a “submit program” button, so I have a button at the end of the page where I submit the data to the database as well as multiple “select all/ deselect all” for different fields.

In that case all you need to do is set the relevant list fields to the selected items, using ‘set list’…

1 Like

Assuming that the “select all/deselect all” functionality that you’ve already built works using a custom state list field of “selected options,” you are correct that you’ll have to also add the functionality to individually add / remove single options from this list.

Create a workflow by right clicking on the checkbox and selecting “start/edit workflow.” This will take you to the workflow tab with the event “when checkbox’s value is changed.” You’ll need to create two versions of this workflow event with conflicting conditions:

  • Only when this checkbox is checked
  • Only when this checkbox isn’t checked

The status of the checkbox in the only when condition represents its value AFTER the change is made, so saying “only when this checkbox is checked” is saying “only when it goes from an unchecked state to a checked state” and saying “only when this checkbox isn’t checked” is saying the opposite.

Those workflows should have actions that add/remove the checkbox’s item from the list, using the “set state” action to reference the existing list, and then the “minus item” or “plus item” operator to add or remove a single option.

Thanks for your help Sam! This solved it for me!