Selectbox reset to default option

Hi guys,

I use the both the selectbox and text_input widgets for getting the user input.
The user can input it’s own text (via the text_input) or choose an existing sample (from the selectbox).

Let’s say the user has chosen the text01 option from the selectbox, and then manually inputted his own text (meanwhile his first choice of text01 still appears at the selectbox. How can, how can I “reset” it’s display to the first option ("" in this case)?

import streamlit as st

if __name__ == '__main__':
    input_slot = st.empty()

    st.write("select an example sentence")
    selected = st.selectbox("select", ["", "aaa","bbb","ccc"])

    val = input_slot.text_input("input", value=selected)

    st.write(val)
    
    # if user inputted manual text:
        # reset selectbox to DEFAULT option

Thank you!

Can you explain what you’d like to happen here? You’d have the user select something but then that selection go back to what it was immediately after in your example.

Hi Ian,
I guess I over simplified my case. I’ve edited my original question with all the details of the scenario.

Thank you.

Hello, Angélica here!
Did you find a way to do it?

Greetings!

Hi Daniel,

Were you able to find a solution to this? I have the exact same use case