Hello everyone!
Iâve wrote a custom search box component based on this example: GitHub - m-wrzr/streamlit-searchbox: Streamlit searchbox that dynamically updates and provides a list of suggestions based on a provided function. It takes list from a search-function and render it as an options to chose from in search field.
It works as it should. However, if I put it into the form:
with st.form(âmy_formâ):
selected_value = custom_searchbox(search_df, key=âtestâ)
st.markdown(âYouâve selected: %sâ % selected_value)
k = st.text_input(âAdditional Text Input in the formâ)
val = st.form_submit_button(label=âSaveâ)
if val:
res = {âtext inputâ: k, âsuffered componentâ: selected_value}
st.write(res)
search field does not render items:
But logic behind search function definitely works â if push save it does render my list from search-function:
And search box outside the form works as it should and returns stuff from either the search field and form when form is invoked:
selected_value = custom_searchbox(search_df, key=âtestâ)
with st.form(âmy_formâ):
st.markdown(âYouâve selected: %sâ % selected_value)
k = st.text_input(âAdditional Text Input in the formâ)
val = st.form_submit_button(label=âSaveâ)
if val:
res = {âtext inputâ: k, âsuffered componentâ: selected_value}
st.write(res)
So my questions is: Why component does not render list inside of form (is it some form innate hinderance? ) And how name scope works considering this components?