clear form after submit

It might be a "stupid" question....<br />
<br />
I have a form and when I submit the form the textfields are not cleared...<br />
How can I clear the textfield after a submit?<br />
<br />
Can someone help me?<br />
Thanks<!--content--><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"<br />
"http://www.w3.org/TR/html4/strict.dtd"><br />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><br />
<meta name="Content-Script-Type" content="text/javascript"><br />
<form action="mailto:[email protected]" onsubmit="this.submit(); this.reset(); return false"><br />
<div><br />
<input type="text"><br />
<input type="submit"><br />
<div><br />
</form><!--content-->FYI to people pickign this up on searches: It doesn't work. <br />
<br />
Don't yet know what does, but this doesn't. <br />
<br />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"<br />
"http://www.w3.org/TR/html4/strict.dtd"><br />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><br />
<meta name="Content-Script-Type" content="text/javascript"><br />
<form action="mailto:[email protected]" onsubmit="this.submit(); this.reset(); return false"><br />
<div><br />
<input type="text"><br />
<input type="submit"><br />
<div><br />
</form><!--content-->Seems to work allright here. It sends the form and then clears the input box. Isn't that what you wanted in the first place?<!--content-->As far as I can see, this does not submit the form before clearing the INPUTs.<!--content-->then try reset the form onload<br />
<br />
<script type="text/javascript"><br />
onload = function(){<br />
document.forms['formname'].reset()<br />
}<br />
</script><!--content-->Onload won't work if form is never reloaded -- e.g., if you are targeting a new window for the form.<!--content-->http://www.webdeveloper.com/forum/showthread.php?t=115284<br />
hopefully this helps<!--content-->
 
Back
Top