Query database and display conditions after form submission

Hello,
I have a form where I need to know if the name included in st.text_input exists in the database, if it exists, the list will be displayed for the user to decide whether he will want to use an existing record or a new one.

The problem is that after clicking the submit button, I call the function and bring the list of users but the page reloads due to the state of the submit button.

would there be any alternative? Unfortunately the submit button does not allow new widgets below it.

follow my code


st.subheader('Incluir Visitante')
    with st.form(key="include_visitante",clear_on_submit=True):
        if visitanteRecuperado ==None:    
            input_name=st.text_input('Nome',key=str,placeholder='Nome / Conjunto / Congregação')
            input_sexo=st.radio('Sexo',('M','F','Grupo / Conjunto'),horizontal=True)
            input_age=st.number_input(label='Idade',key=int,help='_Importante para saber a faixa etária dos visitantes_',format="%d",step=1)
            input_recorrente=st.selectbox('Primeira Vez?',('Não','Sim'))
            input_observacao=st.text_input('Observações',help='_Cantora, pastor, etc_')
            input_adress=st.text_input('Endereço:',placeholder='Bairro, Rua, Nº')
            input_phone=st.number_input(label='Telefone com DDD:',value=(27),help='_Insira somente números com DDD ex 27999999999_')
 input_button_submit=st.form_submit_button("submitted",help='_Lançar visitante no sistema_',use_container_width=True)

if input_button_submit:

Hey @Edielcio_Almeida,

I’d recommend saving the name and other inputs that you need to access to session state so that you can still access them after the submit button has been clicked. This doc has some great info on getting started with session state.

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