Honesta
Honesta

Reputation: 1514

How to Reset Values of a Form AFTER they are submitted.

I have form1 and a submit button that goes like:

<input type="submit" name="submit2" id="submit2" value="Insert" onclick="document.form1.reset();"/>

I want to reset the values of my form after the values are submitted. The above code resets them and then submits the (empty) values.

I have also tried: onclick="document.form1.submit();document.form1.reset();" but it didnt work.

Upvotes: 0

Views: 1467

Answers (1)

yakya
yakya

Reputation: 5220

Append the following to your form's tag:

onsubmit="this.submit(); this.reset(); return false;"

Upvotes: 1

Related Questions