Missing button

Screenshot 2022-12-10 at 12.21.17 PM

with st.sidebar.form(key=“my_form”,clear_on_submit=False):
parameter1=st.selectbox(“Select a parameter”,parametersDp)
parameter1size=st.number_input(label=“Greater than”, value=1000)
parameter2=st.selectbox(“Select a parameter”,parametersDp)
parameter2size=st.number_input(label=“Greater than”, value=1000)
parameter3=st.selectbox(“Select a parameter”,parametersDp)
parameter3size=st.number_input(laberl=“Greater than”,value=1000)
sector=st.selectbox(label=‘Sector’,options=sectorList)
pressed= st.form_submit_button(“Submit”)

I have checked the indentations and are ok but still get an bellow error when using the form

Hi! Please could you edit your code so it is formatted to preserve spacing? (Triple backticks at the beginning and end. (```)

When I recreated the spacing you have in your screenshot, I did not get an error. This worked for me:

with st.sidebar.form(key='my_form',clear_on_submit=False):
    parameter1=st.selectbox('Select a parameter',[1,2,3,4])
    parameter1size=st.number_input(label='Greater than', value=1000)
    pressed = st.form_submit_button('Submit')

parameter1
parameter1size

I was on Streamlit version 1.11.0 at the time. Can you check what Python and Streamlit versions you have?

st.write(st.__version__)

thank you

my version is 1.14.0

code
‘’‘with st.sidebar.form(key=“my_form”,clear_on_submit=False):
parameter1=st.selectbox(“Select a parameter”,parametersDp)
parameter1size=st.number_input(label=“Greater than”, value=1000)
parameter2=st.selectbox(“Select a parameter”,parametersDp)
parameter2size=st.number_input(label=“Greater than”, value=1000)
parameter3=st.selectbox(“Select a parameter”,parametersDp)
parameter3size=st.number_input(laberl=“Greater than”,value=1000)
#Button
pressed=st.form_submit_button(“Submit”) ‘’’

Subtle distinction: The backtick is on the ~ key.

Backtick: `
Single Quote: ’

Alternatively, you can use markdown [code] 
 [/code]

not sure I follow can you pls elaborate
btw I copy/pasted your code and it does not work on mine

In addition I have other forms which I have done which work fine.

That’s just from what you submitted.

I don’t have access to your data, so I’ve subbed in a short list. This snippet does not throw an error for me on Streamlit 1.14.0. If you get a missing button message, then there is some other context within your code that’s relevant or I’m misunderstanding your code spacing since it’s not in a code block. Note you had a typo in your original post “laberl” instead of “label” and also, your widgets should be throwing a “DuplicateWidgetID” error, so here’s the keys to pre-emptively fix that.

with st.sidebar.form(key='my_form',clear_on_submit=False):
    parameter1=st.selectbox('Select a parameter',[1,2,3,4], key='p1')
    parameter1size=st.number_input(label='Greater than', value=1000, key='p1_size')
    parameter2=st.selectbox('Select a parameter',[1,2,3,4], key='p2')
    parameter2size=st.number_input(label='Greater than', value=1000, key='p2_size')
    parameter3=st.selectbox('Select a parameter',[1,2,3,4], key='p3')
    parameter3size=st.number_input(label='Greater than',value=1000, key='p3_size')
    sector=st.selectbox(label='Sector',options=[1,2,3,4])
    pressed = st.form_submit_button('Submit')

thank you very match for your feedback
It seems the solution was to substitute the single column dataframe with a “list” and the button appears.

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