Hi,
Python and Streamlit newbie here so I suspect I am doing something wrong. I have Panda dataframe in a form like so:
def form_02():
# Create empty DataFrame for data entry
form_data_df = pd.DataFrame(
{"Color": pd.Series(dtype="str"), "Quantity": pd.Series(dtype="int")},
index=range(5),
)
my_form_02 = st.form("my_request_02", clear_on_submit=True, enter_to_submit=False)
with my_form_02:
edited_df = st.data_editor(
form_data_df,
column_config={
"Color": st.column_config.SelectboxColumn(
"Color",
width="medium",
options=df_colors["Color"].values,
required=False,
),
"Quantity": st.column_config.Column(
width="small",
required=False,
),
},
hide_index=True,
use_container_width=True,
)
st.form_submit_button("Send Request")
When I first hit the submit button after entering values in the table, I get what I expect and form clears as expected. If I then hit the submit button with nothing entered, the edited_df still has the previous values. I would expect it to be empty in this case. What am I missing in my understanding of the behaviour here and how can I detect if someone is attempting to submit the form without entering anything? Thanks in advance!