How to change selected values inside the Multi-select widget on a button click?

Is it possible to have a button that selects an option in a multiselect widget when it is clicked? I would like to do this in a way that would be harmonious with a user also manually selecting other options from the drop down.

An example of this workflow is a form that allows a user to create a sports team. There is a multiselect dropdown with a list of many people that can be added to the team. There are some people however that are not in the list yet, so there is a sub-form where the user can add a new person to the database. The button that adds the new person, also reruns the query that populates the list of people in the multiselect dropdown. Since the user added the person while completing this form, it is assumed that they would also like to add them to the list. As such, I would like the new person to be automatically selected in the dropdown (without removing any of the previous selections), rather than make the user manually select the person they just added.

Hey @trebuchet! Thanks for reaching out to us. I’ve created a sample app for you that’ll show you how to achieve this. Please fork the app -

Hi @pranav ! Thanks for turning around a quick suggestion. What I am looking for is a way to do this that will no override earlier selections. The goal is that users should be able to select options from the drop down, as well as click the button to add/select options multiple times and in any order without any of the previous selections being undone.

I have gone down the default value path, like in your app, but it seems to me this always results/requires a reset of the widget.