How to refresh a custom form after submission?

I have created a custom form (using several input elements) that successfully collapses after the user clicks the submit button. However, when selecting the form again, the input elements are still populated with the information the user added.

Here is the extract of code from the form submission (once the data insert has been successful):
Is there a way I can add anything to the #registerButton.onClick event that would “refresh” the input elements?

// Insert the requested slot information into the pendingAppointments collection.
 await wixData.insert("soccerMembersDatabase", newRequest);
 // Show the thank you state.
            $w("#submitSuccessBox").show();
            $w("#soccerRegistrationBox").collapse();
            $w("#programSelectDropdown").hide();
            $w("#registerButton").onClick((event) => {
                $w("#submitSuccessBox").hide();
                $w("#programSelectDropdown").show();
            });

What do you mean, when you say —> REFRESH ?

You have your input-fields, where you put in some data.
To reset an input-field, you simply use…

myInputfield = $w('#input1')

myInputfield.value = ""

This should reset the inputfield.

Or the direct way…

$w('#input1').value = ""

If you add a dataset to the page you can add a submit button linked to the dataset when the button is pressed the fields related to the dataset will empty and the data will be written to the database. Otherwise you will probably have to call a function to set the fields to empty like the previous poster suggested.

Simple as that haha. Thank you again, I was just hoping there may be some way I could reset all input fields using a few lines of code instead of having to reset each individual value.

Can I use the declare “myInputfield” line to perhaps = all of the elements and then set the value of all of them this way?

Also, I don’t suppose this would work for dropdown, radio buttons, date pickers and checkboxes.

Thanks andy, I have used code entirely to submit the data to a database so it’s not connected using the editor connect function. I suppose that’s why it isn’t automatically emptying the fields upon submission.

@lisamthorpe
If you use code, then you also have to code everything by your own. From startpoint, till end.