Summary
Hi, i have a Form for an user to fill his data, the fields values user enter are not updated on first click at submit button. But if user will click submit again (without changing the fields content) the updated data will be reflected at python side.
Steps to reproduce
Code snippet:
import streamlit as st
with st.form(key="create_user"):
st.text_input(
label="User Email", key='email'
)
st.text_input(
label="User FullName", key='name'
)
st.radio(label='User Role', options=('READER', 'MODERATOR'), horizontal=True, key='role')
st.form_submit_button(
label="Confirm creating a user",
on_click=print,
args=(st.session_state.name, st.session_state.email, st.session_state.role),
)
The steps are:
- fill name
- fill email
- select role
- click “Confirm creating a user”
Expected behavior:
Once button clicked, python side should print entered data
like this:
testuser testemail READER
Actual behavior:
First time user click on button, the printed result is:
READER
The second time User click data, the printed results are as expected:
testuser testemal READER
Debug info
- Streamlit version: 1.16.0
- Python version: 3.8.10
- Using Conda? PipEnv? PyEnv? Pex? - nothing like these
- OS version: Ubuntu 20.04
- Browser version: FireFox 107