question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

st.form should create proper <form> element (with "enter to submit" support)

See original GitHub issue

From a user request here: https://discuss.streamlit.io/t/enter-key-press-to-submit-st-form/16939

The request is correct: we don’t currently use <form> tags in st.form HTML output. We should consider it!


Community voting on feature requests enables the Streamlit team to understand which features are most important to our users.

If you’d like the Streamlit team to prioritize this feature request, please use the 👍 (thumbs up emoji) reaction in response to the initial post.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:15
  • Comments:6

github_iconTop GitHub Comments

5reactions
frankhuurmancommented, Jun 14, 2022

Not sure how this would work as there can be several submit buttons in the same form

This could be solved by either manually setting a property to the st.form_submit_button to respond to the Enter key input(like st.form_submit_button(label=“Submit”, listen=True) or main=True, enter_to_submit=True… naming things is hard. Throwing an exception if multiple submit buttons in the form have this value set to True.

Or we grab the last entry of all submit buttons in a specific form and always assign that button as the designated listener for the Enter key input.

For now as a workaround you can use 2 more Tabs + Enter to submit (when currently in your final text_input).

2reactions
dectoplatecommented, Apr 2, 2022

“Enter to submit” is very important in a form.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Submitting a form by pressing enter without a submit button
Save this answer. Show activity on this post. IE doesn't allow pressing the ENTER key for form submission if the submit button is...
Read more >
Enter key press to submit st.form - Using Streamlit
Just wondering why pressing the enter/return key in a Streamlit form ... st.form should create proper <form> element (with "enter to submit" support)....
Read more >
<input type="submit"> - HTML: HyperText Markup Language
A string indicating the HTTP method to use when submitting the form's data; this value overrides any method attribute given on the owning...
Read more >
HTML 5.2: 4.10. Forms - W3C
Finally, to make the form submittable we use the button element: ... to specify the URL of the service that will handle the...
Read more >
How to Customize the Submit Button with CSS - Jotform
UPDATE: Try the Form Designer video course to create fantastic Submit ... Submit buttons in web forms should also feel right because that's ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found