Hi @Piero_Chiacchiaretta , I don’t think you can do this with forms. You can try this:
Delete the line: with st.form(key=‘my_form’):
After getting the value of first_name &
last_name, do any validation of these inputs as required (eg. Checking if they both contain valid data, etc.)
Change the line: submit_button = st.form_submit_button to submit_button = st.button and add the disabled parameter depending upon the result of step 2 above. You can refer this in the at.button documentation
This way, only if valid data is entered, the button will be selectable. You can then proceed further as required
You can set the clear_on_submit parameter for st.form() to True. All widgets inside the form will be reset to their default values after the user presses the Submit button:
with st.form(key='my_form', clear_on_submit=True):