Hey @ritesh.sharma29 (and FYI @vbard)
With the release of session state, this can be solved with an even simpler set of code, specific to the streamlit package!
You can store the values of all of your widgets in the state object and then use them on reruns of your app to dynamically change the output, including adding a “next” button to a set or radio options
In fact, I have already answered pretty much exactly this question (just recently) using the new session state feature. Check out that post here: How to create recurring forms with unique keys? - #6 by Marisa_Smith
option_names = ["a", "b", "c"]
output_container = st.empty()
next = st.button("Next/save")
if next:
if st.session_state["radio_option"] == 'a':
st.session_state.radio_option = 'b'
elif st.session_state["radio_option"] == 'b':
st.session_state.radio_option = 'c'
else:
st.session_state.radio_option = 'a'
option = st.sidebar.radio("Pick an option", option_names , key="radio_option")
st.session_state
if option == 'a':
output_container.write("You picked 'a' :smile:")
elif option == 'b':
output_container.write("You picked 'b' :heart:")
else:
output_container.write("You picked 'c' :rocket:")
Check out the blog post here: Store Information Across App Interactions | Session State
State API here: Session State API — Streamlit 0.86.0 documentation
Upgrade Streamlit to 0.84 or above to be able to use this new feature!
Happy Streamlit-ing!
Marisa