How to stop automatic runing

Hi everybody,

I want to pass two values, a min and a max, as variables for my code. I have used for this, st.select_slider , st.number_input, and the problem I have is the same, when I put the minimum value this is automatically launched, and what I want is to put the minimum value, then the maximum and then pass these variables with my β€œsubmit” button. How can I stop the automatic launching of these values and only be able to send them with the submit button?

my code:

      number = st.slider('Insert your min and max value',value=[0.0,1.0])
        
        if(st.button('Submit')): 
            st.write('Your interval is ', number[0],'-',number[1])

Thanks!
Karina

Hi @karina-castillo -

If you need to bundle inputs together in such a way that they all need to be finished before submitting, you can use st.form

https://docs.streamlit.io/library/api-reference/control-flow/st.form

Best,
Randy

Hi @randyzwitch !

Thank you for your quick response. I will use st.form for my problem.

Best,

Karina

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.