geert jaap Alma
geert jaap Alma

Reputation: 11

Streamlit: Error when using a form within a column: Values for the widget with key cannot be set using st.session_state

I am using streamlit and want to use a form within a col (as part of a multi-page application):

def first_page():

col2, col3 = st.columns([6, 2])
rekenprijs = 0

with col3:
    with st.form("test-form"):
         new_value = st.number_input('New value', value=rekenprijs)

         submit = st.form_submit_button(label="Verwerk")

    if submit:
       st.write(new_value)

When pressing the submit button I receive the error:

streamlit.errors.StreamlitValueAssignmentNotAllowedError: Values for the widget with key 'FormSubmitter:Mijnformulier-Verwerk' cannot be set using st.session_state.

I expect the new value is shown on the screen

Upvotes: 1

Views: 30

Answers (0)

Related Questions