Possible to make form disappear after pressing submit?

Hello,

Is it possible to make a form vanish from the page after the submit button is pressed?

Thanks in advance!

Hi @cacosta88,

Thank you for sharing with the Streamlit community!

I would recommend checking out the following post which covers your question:

Hide or Collapse Widgets Upon Submit

The post suggests st.beta_expander as a solution; our documentation of st.beta_expander can be found here.

Hope this helps!

Best,

Caroline

Best,

Caroline

1 Like

Thanks Caroline! This will work for my current use case.

But it would be optimal if the form just vanished without having to be contained within the expander. I have tried it in different ways but with no luck.

Kind regards

1 Like

Hi @cacosta88,

I recommend checking out this forum discussion – it covers this idea of hiding the input area rather than minimizing.

Best,

Caroline

1 Like

Using st.empty() You can do it but it will throw an error, You can check here - Ignore an alert: 'Bad message format' - #16 by unofficed

If you are find with the nasty error, then use the st.empty() . I changed the form in my site though.