My code is automatically running for text input

I want to take multiple text inputs in a for loop. Using st.text_input() for that.
But the code does not wait for the input and it keeps on running even when the input is not passed.

I want to for next input till the user gives first one and presses enter.

1 Like

Can you add a button to be clicked to start processing? Streamlit is not based on callbacks, and so using a button to explicitly start processing. This seems the cleanest way, to me.

Alternately, how do you know when the user is done providing input? Is there a specific phrase or a count of inputs before you consider it done? You can start processing also by checking for either of these cases?

Dinesh

1 Like

Hi @saurabh_pandey, thanks for checking out Streamlit!

This is a great point. How to solve this is both a function of how your code is set up and knowing when to process. Are both user inputs to the same function, or are you managing this some other way?

If Iā€™m not mistaken, this thread and I want to take multiple inputs in a for loop are the same, so closing this one in lieu of the other one having some Python code snippets to try.