Hi,
I am using a form for the first time (amazing functionality) and I am having trouble outputting the contents of my form, outside of the form box? Ideally I want to click submit, and then the output is presented after the black outline of the box.
Here is my code:
with st.form("my_form"):
st.write("Inside the form")
option = st.selectbox(
'Please select a branch',
('','Belgium', 'France', 'Singapore'))
category = st.radio(
'Select a category',
('One', 'Two', 'Three'))
submitted = st.form_submit_button("Submit")
if submitted:
if option == 'Belgium':
df = px.data.iris()
fig = px.scatter(df, x="sepal_width", y="sepal_length", width = 500)
st.plotly_chart(fig, use_container_width = False)
if category == 'One':
st.write('This returns chart one')
elif category == 'Two':
st.write('This returns chart two')
elif option == 'France':
df = px.data.iris()
fig = px.scatter(df, x="sepal_width", y="sepal_length", width = 500)
st.plotly_chart(fig, use_container_width = False)
if category == 'One':
st.write('This returns chart one in France')
elif category == 'Two':
st.write('This returns chart two in France')
To further clarify, like the example in the sample app here, the output is presented outside of the form box:
https://streamlit-release-demos-0-81streamlit-app-0-81-doxgfr.streamlit.app/?page=forms_demo
Also, is it possible to see the code behind this app?
Thanks a lot