Auto save in Streamlit Form

Hi everyone,

I’m using st.data_editor within a st.form, but I need to implement autosave functionality and I am unable get the data from st.form update until the form is submitted to trigger autosave. Moving the data_editor outside the form isn’t viable because it triggers a full page reload. Does anyone have a workaround for autosaving data in a Streamlit form?

Thanks in advance

Hi! I think at the moment this is not doable using forms.

Alternatively you can replace the st.form with indipendent components and assigning a key to each of them. In this way at every focus change (component focus switch, click outside of a component, …) the corresponding key will be updated and you can trigger a SAVE functionality somehow

Can you try using a fragment instead of a form? With a fragment, instead of a front-end only section until submitted, you get a isolated rerun of the fragment (until you trigger a full rerun with something like a submission).

1 Like