with st.form(key="update_status"):
selected_code = st.selectbox('select code', df["code"].tolist())
selected_status = st.selectbox('select status', status)
btn = st.form_submit_button('submit')
print(btn)
if not btn:
submit_status(selected_code, selected_status)
I found two issues not complied with the document:
if I use āon_clickā to call submit function, two select values canāt be updated
if I use return value of submit button to call it, return bool value is oppsite to common sense. Only like my code, the evnent to click button can be invoked.
I donāt understand how to create a form in streamlit acting like other web forms. Is it because of document or bugs in code?
Thanks joe. I tried the way you mentioned that caused the same result. But I did find out why just now.
Thereās a button to load the whole UI manually in the code. When I move this function to the root of code that resolves the problems above. I guess streamlit using āreload the whole pageā to pass params to submit function. This design idea blows my mind.
I saw your post before, but I donāt recomend you to take time on it. IMHO, streamlit is only appropriate to the single page for ML charting and itāll reload the whole page on any trivia change. Itās better for you to find another solution even Google Docs.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking āAccept allā, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.