Basically, I'm wanting to have a form submitted, then validated via Javascript, then sent off to the CGIemail to be sent off. That's what I'm wanting, that's not what I'm getting If I set the action to an email address, it wants to send the emial of nicely, but if I set it to anything else, all it does it jump to the anchor This is basically how my code looks (stripped down of the unnecessary stuff), I'm a javascript novice so go easy, my mistake is probably staring me in the face <html> <head> <title>It no workie! :(</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language="JavaScript"> function validate_form() { var pass = true if (!checkRequiredFields()) { document.email_form.Name.focus(); pass = false } if (pass == true) { document.email_form.submit() } } function checkRequiredFields() { strName= document.email_form.Name.value if (strName == "") { alert("One or more of the required fields are not completed. Please complete them, then submit again!"); return false; } else { return true } } </script> </head> <body> <a name="form"></a> <form onSubmit="validate_form()" method="post" name="email_form" action="/cgi-sys/cgiecho/template.txt"> Name <input type="text" name="Name"><br> <a href="#form" onClick="validate_form()">Submit Form</a> </form> </body> </html> Code (markup):
Well, i managed to sort out most of the problems, now it's onSubmit="return validate_form()" in the <form> tag. However, even if the form returns true, CGIemail doesn't send the email off (the page does nothing). Anyone ehre have an idea why, and how to fix it?