View Full Version : Why is my form clearing?

02-16-2012, 05:07 AM
So I made a form in html and whenever I type something in my textfields and it shows error messages, after that it refreshes (or resets) and clears all the text I wrote in the text fields.

But when I type in onsubmit = "return validate()", than it duplicates my error messages but it does not clear my form

I am guessing my problem is in the html so I will show you it.

<form id="assignment" name="assignment" method="post" action= "" onsubmit = "return validate()">

<input type="submit" value="Submit" />

and on my code the ending goes like this:

if(message != "")
return false;
return true;

Thanks alot!

02-16-2012, 11:13 AM
Please provide your complete code.

02-17-2012, 03:49 AM
If you want to reset your form correctly, put this code within the <form></form> tags:

<button type="reset">Reset All</button>