Hi! I am new to Python and Streamlit, so this might not make sense . What I would like to do is, within a form, to get data from one input field and use it in another input field.
I have the following code:
full_date = date_input('Date:', datetime.date.today(), key='data_inv_key', help=None, format="DD.MM.YYYY")
year = full_date.year
selectbox('Label', (f"the year {year} was a good one", f"the year {year} was a bad one", index=0)
Currently, when I run the app, the date_input is populated with today’s date and the options under the selectbox are showing year 2024 as expected. But if I select a different year in the date_input box, the year used by the select box does not update.
So, is it possible to read the new selected date and use it in the selectbox f string, without submitting the form?
If at all possible, I guess the solution implies using session_state but I am a newbie and couldn’t crack it.
Thanks in advance!