'Select all' checkbox should select all options in a form multiselect

Streamlit v1.49.0, Python 3.13.5

I have an st.form. Inside of that form is an st.multiselect. I want to add an st.checkbox that appears after the multiselect that, when checked, selects ALL the values in the multiselect.

I am aware that, under normal circumstances, changes inside a form don’t take effect until after the form is submitted. I have reviewed a number of threads (here, here, and here especially), and the answers either:

a) aren’t exactly what I’m looking for - e.g. they update a multiselect based on a checkbox, but not inside a form

b) don’t seem to work anymore, at least not on my Streamlit version - eg this solution or this one

Is there a way to do this? It appears based on some of the above answers it may have been possible at one point, but doesn’t seem to work on Streamlit v1.49.0.

@edsaac I’m wondering if you could help me out here? I saw your comment on this thread: Updating radio inside a form - #4 by edsaac . I copied and pasted your code into the Streamlit Playground ( Playground • Streamlit ) and it works just like in your screen recording, and yet when I try the exact same thing locally or in my own Streamlit app, toggling between the “Plants” and “Animals” radio buttons has no effect at all.

(I’m on Streamlit 1.49.0. I’ve tested both on Firefox 143.0.4 and Chrome 141.0.7390.55.)

Any ideas? Thank you!