I’m working on PKT quiz app using Streamlit , the functionality is like once 10min timer s reached st.form_submit_button should be clicked automatically and user quiz response should be recorded. I had tried with sesssion_state , but it dint work. Can
someone please advice.?
But sorry I ll not b able t share repo directly as its internal client use case. Sharing you the code snippet, hope it helps. Kindly revert for any more details! Thanks!
Expectation : Either use should be able t click on form submit button before 10min or once time elapses it should be clicked automatically.
It sounds like you need an automatic submission of a Streamlit form after a timer expires, is that correct?
If so, Streamlit does not directly support triggering events like form submissions based on a timer. However, you could use an alternative approach with the streamlit Python package and a Python timer. You can use st.session_state to control when to show the form and when to process the submission based on the elapsed time.
I hope that makes sense. Let me know if you need any guidance in building this!
Yeah I did try st.session_state , but its not working as session_state flag is unable to capture user response . Few other approaches which I hav tried and dint work include javascript trigger , Threads and Selenium tool.
Its part of the code , but here s where I wanna implement the logic t auto click on st.form_submit_button(“Submit”,on_click=save_responses) when timer is elapsed.
Based on our code, I’ve tried several app variations trying to create a timer and leveraging session state. I haven’t come to anything satisfying enough yet, but I’ll keep trying and will keep you posted.
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.