jeanie_rc
Wed 13th Aug '03, 2:50pm
Hi - I need to perform multiple action on submit - validate (meaning just make sure all required fields have been entered), send email to a specific person and then have the user go to a confirmation page. below is the code - i am not sure how to have the user go to another page! any help will be greatly appreciated! The code below validates the form and also sends the email - but what do i do to send the user to the confirmation page?
<SCRIPT Language="Javascript">
if (window.focus) {
self.focus();
}
</SCRIPT>
<SCRIPT Language="Javascript">
function mycursor()
{document.form1.field1.focus();}
function isEmpty(s)
{
return ((s == null) || (s.length == 0))
}
function ValidateForm()
{
var returnVal = false;
var myField;
myField = document.form1.field1;
if (isEmpty(myField.value))
{
alert('Please enter your field1.');
myField.select();
myField.focus();
return returnVal;
}
}
</script>
<HTML><HEAD>
<META HTTP-EQUIV="content-type" CONTENT="text/html;charset=utf-8">
<TITLE>Form</TITLE>
<style>
font.prompt {color:"#5a4b8f"; font-weight: bold}
h2.pageHeading{color:"#5a4b8f"}
</style>
</HEAD>
<center>
<h2 class="pageHeading">
Registration Form
</h2>
<BODY onLoad="mycursor();" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<FORM NAME="form1" ACTION="mailto:name@domain.com" enctype="text/plain"
METHOD="POST" onSubmit="return ValidateForm();">
<p> Please take a moment to fill out the form. * indicates required fields</p>
<table border=0>
<tr>
<td align=right><font class=prompt>Field1*</font>
</td>
<td>
<input type=text name='field1' width=50 size=25 value="">
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr><td> </td>
<td><input type="submit" value="Submit"></td></tr>
</table>
</center>
</FORM>
<SCRIPT Language="Javascript">
if (window.focus) {
self.focus();
}
</SCRIPT>
<SCRIPT Language="Javascript">
function mycursor()
{document.form1.field1.focus();}
function isEmpty(s)
{
return ((s == null) || (s.length == 0))
}
function ValidateForm()
{
var returnVal = false;
var myField;
myField = document.form1.field1;
if (isEmpty(myField.value))
{
alert('Please enter your field1.');
myField.select();
myField.focus();
return returnVal;
}
}
</script>
<HTML><HEAD>
<META HTTP-EQUIV="content-type" CONTENT="text/html;charset=utf-8">
<TITLE>Form</TITLE>
<style>
font.prompt {color:"#5a4b8f"; font-weight: bold}
h2.pageHeading{color:"#5a4b8f"}
</style>
</HEAD>
<center>
<h2 class="pageHeading">
Registration Form
</h2>
<BODY onLoad="mycursor();" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<FORM NAME="form1" ACTION="mailto:name@domain.com" enctype="text/plain"
METHOD="POST" onSubmit="return ValidateForm();">
<p> Please take a moment to fill out the form. * indicates required fields</p>
<table border=0>
<tr>
<td align=right><font class=prompt>Field1*</font>
</td>
<td>
<input type=text name='field1' width=50 size=25 value="">
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr><td> </td>
<td><input type="submit" value="Submit"></td></tr>
</table>
</center>
</FORM>