Hi Community,
I am facing issue in updating the session state value.I have session state variable outside the form and trying to update the session state variable inside the form after click of submit.
if 'toggle' not in st.session_state:
st.session_state['toggle']=False
if st.session_state.toggle == False:
tab21,tab22, tab11,tab12 = st.tabs(["ON CHART","ON DATA","OFF CHART","OFF DATA"])
else:
tab11,tab12, tab21,tab22 = st.tabs(["OFF CHART","OFF DATA","ON CHART","ON DATA"])
with st.form("Manual Override"):
chkBox=st.checkbox(label='Disable Toggle',value=False,key='Toggleradio')
submitted = st.form_submit_button("Apply Constraints")
if submitted:
if chkBox == True:
st.session_state.toggle = not st.session_state.toggle
Basically i am trying to toggle the tabs with session state. Kindly help me understand where do am i going wrong or code snippets with how to achieve the tabs toggle when there is a variable state change inside the form
Regards
Sridhar Rajaram