Hide User Input Elements after form Submission

Is there a way to hide user input elements after the user submits their information?

For example, I have a form with 3 user input elements and 1 submit button. A success message displays after the user hits the submit button. However, the message displays over the user input elements. I would like the user input elements to permanently disappear when the success message is displayed.

$w(‘#submitButton1’).onClick((event) => {

$w(‘#input1’).hide();
$w(‘#input2’).hide();
$w(‘#input3’).hide();
})

Thank you!

Hi Mike,
this code works fine, but I need a little more twist.

By clicking the submit button, I want select elements to hide only if submission was successful.

export function submitbutton1_click_1(event){
    $w('#dropdown1').hide();}

On the same topic, I would like the next section of the form to expand only if the form submit is successful. Cannot find the syntax to make this work.

I also looking how to close a box with a user inputs after if Submit was succsesfull…

Found the solution. You select the dataset icon, and in the properties panel select onAfterSave. It will give you the starter code.

Please post a new post rather than jump onto an old post from Jan 2019, thank you.

If you are using the Wix Submit button then you already have an option to go to a link after it is successful…
https://support.wix.com/en/article/adding-a-submit-button-to-your-form

If you want to do something else on successful submission, then have a read of this page.
https://support.wix.com/en/article/corvid-adding-success-and-error-messages-for-elements-without-a-submit-option