Hello
How to change items in the form with changing items in a selectbox ?
for example when i change private to busuness, then automatically the next text lable change.
import streamlit as st
st.title(‘Registration form’)
with st.form(“my_form”):
st.subheader('Customer information')
ct = ['Private','Business']
ctype = st.selectbox('Customer type', ct)
if ctype == 'Private' :
cname = st.text_input('Name and family name')
else:
company = st.text_input('Company name')
submitted = st.form_su
Because st.form is designed to not register any changes until you press the submit button, the easiest solution is to not put things in a form. For example:
import streamlit as st
st.title("Registration form")
st.subheader("Customer information")
ct = ["Private", "Business"]
ctype = st.selectbox("Customer type", ct)
if ctype == "Private":
cname = st.text_input("Name and family name")
else:
company = st.text_input("Company name")
submitted = st.button("Submit")
if submitted:
...