Update the value of submit button using the session state

You can use session_state to store information if you need to extend the memory of buttons. I just recorded a tutorial if you want to check it out. Session State Introduction

You can add a callback function to your form submit button like this:

if 'submitted' not in st.session_state:
    st.session_state.submitted = False

def update():
    st.session_state.submitted = True

# Your Form Here
st.form_submit_button('Submit', on_click=update)

if st.session_state.submitted:
    st.write('Form submitted')
2 Likes