How to have 2 columns on a form

Hi,

Inside a with st.form(‘my_form’), how to put 2 data entry columns on it?

From Date                       Time
date_input()                    time_input()
To Date                         Time
date_input()                    time_input()

Submit Button

Thanks!

Hi, you can do the following:

#After your with st.form statement… add
c1, c2 = st.columns(2)
With c1:
#Add controls you want to show in column 1

With c2:
#Add controls you want to show in column 2

add your submit button

Hi @Shawn_Pereira ,
This doesn’t seem to work ,
This is my code , can you help ?

form = st.form(key="my-form")
c1, c2 = st.columns(2)
with c1:
    sel1= form.selectbox("Report Type", ("normal", "full"))
with c2:
    track= form.text_input("enter track no").upper()
submit = form.form_submit_button("Generate Report")

if submit:
    with st.spinner('Generating Report....'):

This worked.

Thank you!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.