Summary
Cannot seem to figure out how to get the submit form button to actually work.
Steps to reproduce
Code snippet:
if st.sidebar.button("Add User"):
with form_container:
with st.form("add user"):
st.write("Add User")
email = st.text_input("Email")
customers = get_customers()
customer = st.selectbox("Customer",customers)
password = st.text_input("Password")
submit_button = st.form_submit_button(label="Submit")
if submit_button:
print("Submit button pressed")
create_user(email,customer,password)
If applicable, please provide the steps we should take to reproduce the error or specified behavior.
Expected behavior:
Should print “Submit button pressed”, and call function.
Actual behavior:
Pressing the Submit button does clear the form, but nothing I do seems to actually set submit_button to True.
Debug info
- Streamlit version: (get it with
$ streamlit version
) - Python version: (get it with
$ python --version
) - Using Conda? PipEnv? PyEnv? Pex?
- OS version:
- Browser version:
Requirements file
Using Conda? PipEnv? PyEnv? Pex? Share the contents of your requirements file here.
Not sure what a requirements file is? Check out this doc and add a requirements file to your app.
Links
- Link to your GitHub repo:
- Link to your deployed app:
Additional information
If needed, add any other context about the problem here.