Hello every one ,
I am new around and i am trying to POC a small web App with streamlit using it on the snowflake environnement so this means streamlit 1.26 version.
When it comes to create selectbox it worked well but then i wanted to disable the other selectbox because value in one is choosen , i can’t do it because i can’t call again the same selectbox.
I am using a function here but i am opened to new idea .
Here is the part that doesn’t work and my error message :
#select a checkbox to print a selectbox
#initialisation of the variables to false
disabled_select_restaurantuniqueid = False
disabled_select_BK_number = False
disabled_select_nomdurestaurant = False
select_restaurantuniqueid = ""
select_BK_number = ""
select_nomdurestaurant = ""
def selectbox(disabled_select_restaurantuniqueid,disabled_select_BK_number,disabled_select_nomdurestaurant) :
select_restaurantuniqueid = st.selectbox('RESTAURANTUNIQUEID',options = list_restaurantuniqueid,index = 0 ,disabled = disabled_select_restaurantuniqueid)
select_BK_number = st.selectbox('BK',list_BK_number,index = 0,disabled = disabled_select_BK_number )
select_nomdurestaurant = st.selectbox('NOMDURESTAURANT',list_nomdurestaurant,index = 0,disabled = disabled_select_nomdurestaurant)
return select_restaurantuniqueid,select_BK_number,select_nomdurestaurant
select_restaurantuniqueid = ""
select_BK_number = ""
select_nomdurestaurant = ""
selectbox(disabled_select_restaurantuniqueid,disabled_select_BK_number,disabled_select_nomdurestaurant)
if select_restaurantuniqueid != list_restaurantuniqueid[0]:
disabled_select_BK_number = True
disabled_select_nomdurestaurant = True
if select_BK_number!= list_BK_number[0]:
disabled_select_restaurantuniqueid = True
disabled_select_nomdurestaurant = True
if select_restaurantuniqueid != list_nomdurestaurant[0]:
disabled_select_BK_number = True
disabled_select_restaurantuniqueid = True
selectbox(disabled_select_restaurantuniqueid,disabled_select_BK_number,disabled_select_nomdurestaurant)
here is my error message : DuplicateWidgetID: There are multiple identical st.selectbox
widgets with the same generated key.
When a widget is created, it’s assigned an internal key based on its structure. Multiple widgets with an identical structure will result in the same internal key, which causes this error.
Here is a screen of the frondend :
so i would like the other selectbox than the one selected to be disable , in this case the 2nd and 3rd one
Thanks for your time and ideas
Zuwhity