How to disable default text_input "Enter" action

Would like to disable the default “Enter” action of text_input.

1 Like

Hi @Arjun_Prasaath

There’s the disabled parameter for the st.text_input() method.

An example of how I used this for an app is provided in the following code snippet:

query_text = st.text_input('Enter your query:', placeholder = 'Enter query here ...', disabled=not uploaded_file)

which is used in the GitHub repo:

Hope this helps!

Best regards,
Chanin

Hi everybody!
Thank you @dataprofessor for your answer.
Maybe I simply don’t understand your code correctly, but I don’t think your suggestion tackles the problem. I think @Arjun_Prasaath wants to deactivate the function of a text_input to submit the entire form when pressing enter after filling it out.
I am facing the same challenge. My app involves multiple text_input widgets, and I don’t want user to submit unintentionally too early by pressing enter to confirm their input.
In that sense, I don’t want to disable the widget, but just the function of submitting the whole form on one enter-click.

I’m also facing a similar issue. The default action upon pushing enter for a text_input widget in a form is to submit the form. This is not a desirable default if there are multiple text_input widgets. Making the hotkey, ⌘ + enter, to submit the form like it is for text_area would be a better solution.