Allow st.form enter_to_submit to work for non-text elements
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with the provided st.form(..., enter_to_submit=True) example and reproduce the behavior for radio, dataframe, number_input, selectbox, and text_input alongside st.form_submit_button. Done means Enter submits the form consistently for supported non-text elements without regressing text input behavior.
Written by the indexing model from the issue text.
Description
Checklist
- I have searched the existing issues for similar feature requests.
- I added a descriptive title and summary to this issue.
Summary
I found that enter to submit only works for text entry elements - it doesn't work for:
- radio selections
- dataframe selections
- number inputs
- presumably others (selectbox etc.)
Why?
When I test my own forms, which rely on the st.dataframe row selection feature, intuitively I select and press Enter (Return) and expect the form to submit.
Limiting this only to text reduces the usefulness of forms, quite a lot for me
How?
however the text input works -- repeat for all input elements!
Squeezing in the 'Enter to submit' message probably isn't possible, but that's okay.
Additional Context
import streamlit as st
import pandas as pd
test_number = 0
with st.form(key='form_select_step',enter_to_submit=True):
a1,a2,a3,a4 = st.columns([25,25,25,25])
test_radio = a1.radio('radio',['test1','test2','test3'],index=0)
test_dataframe = pd.DataFrame({'test':[1,2,3]})
a2.write('dataframe')
test_dataframe_selection = a2.dataframe(test_dataframe,on_select='rerun',selection_mode='single-row')
test_number = a3.number_input('number',value=10)
test_string = a4.text_input('string',value='test')
st.form_submit_button('form submit')
a1,a2,a3,a4 = st.columns([25,25,25,25])
a1.write('Test Radio:')
a1.write(test_radio)
a2.write('Test Dataframe Selection:')
a2.write(test_dataframe_selection)
a3.write('Test Number:')
a3.write(test_number)
a4.write('Test String:')
a4.write(test_string)
- Dominant language
- Python
- Stars
- 45.8k
- Forks
- 4.4k
- Avg merge
- 21h 22m
- Merged PRs (30d)
- 316
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from streamlit/streamlit
-
area:backend area:network feature:embedding feature:runtime priority:P3 status:confirmed type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
area:frontend area:security feature:st.file_uploader status:unlikely type:enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
area:backend area:security feature:cache feature:cache-hash-func priority:P4 status:confirmed type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
area:mobile feature:st.camera_input papercut type:enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
area:ai type:enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
All issues in streamlit/streamlit
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100