• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Clear a form onSubmit


C

chrismitchell

Guest
#1
Right everyone.. rookie mistake but can't work it out.. can someone tell me why my form isn't resetting after the email is sent?

Code:
<form id="ajax-contact-form" class="newsletter-form" method="post" action="contact.php" action="javascript:alert('success!');" OnSubmit="setTimeout('clear_form()', 200); return true"><div class="wrapper-level2"><div class="title" style="font-size:1.25em;line-height:1.2em;padding-top:2px;margin-bottom:-20px;"><strong>Request to join now</strong></div><label> <b>Name:</b><input type="text" name="name" value="name" /></label><label> <b>Email:</b><input type="text" name="email" value="email" /></label>  <input type="checkbox" value="" id="checkbox" /><span>I agree to the <i><a href="terms.pdf">Terms</a></i></span> <div class="clear"></div><br/><input name="submit" type="image" class="btn" src="../images/submit.png" value="Send" /><div class="clear"></div>			</div></form>
The code i'm using to clear the form is:

Code:
<?php function clear_form() {document.execute.reset(); }?>
this code is in the header, but i just can't seem to work out why its not working.

Any help would be great.. having a bit of a dumb moment and just need some help :)

Thanks all :)
 

Jazajay

Active Member
#2
Hay Bird!

Where is execute coming in?
Also wont the page just submit itself anyway meaning that is pretty pointless?
What errors are you getting in Firefoxs Error Console? :)