Click to See Complete Forum and Search --> : clear form after submit
cristalleke
05-07-2003, 08:59 AM
It might be a "stupid" question....
I have a form and when I submit the form the textfields are not cleared...
How can I clear the textfield after a submit?
Can someone help me?
Thanks
Charles
05-07-2003, 09:36 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<form action="mailto:fie@foe.fum" onsubmit="this.submit(); this.reset(); return false">
<div>
<input type="text">
<input type="submit">
<div>
</form>
escoles
07-27-2006, 04:15 PM
FYI to people pickign this up on searches: It doesn't work.
Don't yet know what does, but this doesn't.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<form action="mailto:fie@foe.fum" onsubmit="this.submit(); this.reset(); return false">
<div>
<input type="text">
<input type="submit">
<div>
</form>
gooncorp
07-27-2006, 04:24 PM
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?
escoles
07-27-2006, 04:41 PM
As far as I can see, this does not submit the form before clearing the INPUTs.
then try reset the form onload
<script type="text/javascript">
onload = function(){
document.forms['formname'].reset()
}
</script>
escoles
07-27-2006, 05:02 PM
Onload won't work if form is never reloaded -- e.g., if you are targeting a new window for the form.
pacerier
08-05-2006, 03:21 AM
http://www.webdeveloper.com/forum/showthread.php?t=115284
hopefully this helps