I’m trying to require file extensions on a text_input widget, but since it’s a part of my form it causes the form_submit_button to not show up on the page.
Error
Missing Submit Button
This form has no submit button, which means that user interactions will never be sent to your Streamlit app.
To create a submit button, use the st.form_submit_button() function.
For more information, refer to the documentation for forms.
def main():
with st.form("Form For File Search"):
search_text = st.text_input("Enter filename", placeholder="example_file.csv")
if search_text.endswith(".txt"):
start_date = st.date_input("Start date", format="YYYY-MM-DD", key="start_date")
end_date = st.date_input("End date", format="YYYY-MM-DD", key="end_date")
st.form_submit_button("Submit", )
if search_text and start_date and end_date:
df = get_df(search_text, start_date, end_date)
with st.container():
st.table(df)
Versions
streamlit 1.29.0
Python 3.10