I am running into an issue in one of my apps with a date input widget. For this app, the widget allows the user to input a date range which then controls a bar chart in the app.
One thing I have noticed is that when selecting the dates from the calendar the app re-runs upon selection of the first date (before the second date is selected) which causes an index error in my code every time. When the user selects the second date everything runs smoothly, but it is not the best user experience to get a full page error in the middle of selecting their desired date range.
Any tips on how to avoid app execution until a complete selection is made?
Hi randy, thank you for your suggestion but I am facing the same problem and I canβt get your suggested solution to work.
I doubt it is even possible as the expected output from the 'st.date_input(β¦) statement in this example are 2 variables. Streamlit immediately throws an error when selecting βstart_dateβ because the end_date variable is not defined yet. ie the error is generated even before getting to the if-statement. The same happens when
Perhaps I am mis-understanding you suggested solution, so maybe you could clarify on this?
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.