I have a basic form with validation. Each field is required to be filled in. If all the fields are completed, after submission, I want the person to be directed to “thanks.htm”. How can I make this work? Here’s the code:
<body onLoad=”checkData()”>
<!– START OF SCRIPT –>
<script language=”JavaScript”>
<!–
function checkData (){
if (document.prayerrequest.NAME.value == “”) {
alert(“Please fill in your Name.”)
document.prayerrequest.NAME.focus()
return false}
if (document.prayerrequest.TELEPHONE.value == “”) {
alert(“Please fill in your Telephone Number.”)
document.prayerrequest.TELEPHONE.focus()
return false}
if (document.prayerrequest.DATE.value == “”) {
alert(“Please fill in Date of Request.”)
document.prayerrequest.DATE.focus()
return false}
if (document.prayerrequest.PRAYERREQUEST.value == “”) {
alert(“Please fill in your Prayer request.”)
document.prayerrequest.PRAYERREQUEST.focus()
return false}
}
// –>
function doVerify()
{
location.href = “thanks.htm”
}
</script>
<form action=”mailto:
<pre>
1. Name <textarea name=”NAME” rows=”1″ cols=”70″></textarea>
<br>
2. Telephone Number <textarea name=”TELEPHONE” rows=”1″ cols=”20″></textarea>
<br>
3. Date of request <textarea name=”DATE” rows=”1″ cols=”20″></textarea>
<br>
4. Care request and/or prayer needed.
<br>
<center><textarea name=”PRAYERREQUEST” rows=”20″ cols=”75″ wrap></textarea></center>
<br>
<center><INPUT TYPE=”submit” VALUE=”SEND EMAIL!”> <INPUT TYPE=”reset” VALUE=”CLEAR FORM”></center>
</pre>
</form>
<!– END OF SCRIPT –>
</font></font></strong>
</body>
Thanks for any help in making this work.