Hi,
I am creating a basic streamlit app, where i am selecting the values from the dropdown and few dropdown i need to populate from one of the drop down value, where my session state value is not getting updated,
import streamlit as st
st.set_page_config(layout="wide")
family_list = ["", "Casual", "Evening", "Fusion", "Occasion"]
style_status_list = ["", "Digital", "Experiment", "Festive", "Non Catalogue", "Planned"]
resprestentive_list = ["", "Jacky", "Kapil Jain", "Mehul", "Ramakant"]
vendor_list = ["", "Design For Life", "Yash Creation", "Dimple"]
vendor_location_list = {"Design For Life": "Bangalore", "Yash Creation": "Delhi", "Dimple": "Mumbai"}
if "vendor_location" not in st.session_state:
st.session_state.vendor_location = None
st.session_state.vendor_location
family_col, style_status_col, resprestentive_col, vendor_col, vendor_location_col = st.columns(5)
with family_col:
family = st.selectbox("FAMILY:", family_list)
with style_status_col:
style_status = st.selectbox("STYLE STATUS:", style_status_list)
with resprestentive_col:
resprestentive = st.selectbox("RESPRESTENTATIVE:", resprestentive_list)
with vendor_col:
vendor = st.selectbox("VENDOR:", vendor_list)
with vendor_location_col:
st.text("VENDOR LOCATION:")
if vendor != "" and st.session_state.vendor_location is None:
st.session_state.vendor_location = vendor_location_list.get(vendor, "")
st.text(st.session_state.vendor_location)
submit = st.button("submit")
if submit:
errors = []
if family == "":
errors.append("Please select value")
if style_status == "":
errors.append("Please select value")
if resprestentive == "":
errors.append("Please select value")
if vendor == "":
errors.append("Please select value")
if errors:
for error in errors:
st.error(error)
else:
st.info("success")