Can someone help me with this, I am trying to get this form to validate the fields by checking to see the length of the valu within each field. I also need the form to email me the results. Its crude, and this is how its going to have to work. I am also having trouble with the radio buttons, how do i check to see if something is checked?
Thanks.
<script>
function confirmReset() {
var resetForm = confirm(“Are you sure you want to reset the form?”);
if (resetForm == true)
return true;
return false;
}
function validate() {
if (document.order.firstname.value.length < 2) {
alert(“Please enter your full first name.”);
return false;
}
if (document.order.lastname.value.length < 2) {
alert(“Please enter your full last name.”);
return false;
}
if (document.order.street.value.length < 5) {
alert(“Please enter your full street address.”);
return false;
}
if (document.order.city.value.length < 2) {
alert(“Please enter your full city name.”);
return false;
}
if (document.order.state.value.length < 2) {
alert(“Please enter your state.”);
return false;
}
if (document.order.zip.value.length < 5) {
alert(“Please enter your zip code.”);
return false;
}
if (document.order.phone.value.length < 7) {
alert(“Please enter your phone number.”);
return false;
}
if (document.order.email.value.length < 5) {
alert(“Please enter your email.”);
return false;
}
if (document.order.form.value.length < 1) {
alert(“Please enter your email.”);
return false;
}
return true;
}
</script>
<form name=”order” id=”order” onSubmit=”return validate(); action=”mailto:
<table border=”0″ width=”250″ cellspacing=”0″ cellpadding=”0″>
<tr>
<td width=”50%”><b>First Name:</b></td>
<td width=”50%”><input name=”firstname” id=”firstname”></td>
</tr>
<tr>
<td width=”50%”><b>Last Name:</b></td>
<td width=”50%”><input name=”lastname” id=”lastname”></td>
</tr>
<tr>
<td width=”50%”><b>Street Address:</b></td>
<td width=”50%”><input name=”street” id=”street”></td>
</tr>
<tr>
<td width=”50%”><b>City:</b></td>
<td width=”50%”><input name=”city” id=”city”></td>
</tr>
<tr>
<td width=”50%”><b>State:</b></td>
<td width=”50%”><input name=”state” id=”state” size=”3″></td>
</tr>
<tr>
<td width=”50%”><b>Zip:</b></td>
<td width=”50%”><input name=”zip” id=”zip” size=”10″></td>
</tr>
<tr>
<td width=”50%”><b>Phone:</b></td>
<td width=”50%”><input name=”phone” id=”phone”></td>
</tr>
<tr>
<td width=”50%”><b>Email:</b></td>
<td width=”50%”><input name=”email” id=”email”></td>
</tr>
<tr>
<td width=”50%” valign=”top”><b>Type of Form:</b></td>
<td width=”50%”>
<input type=”radio” name=”form” value=”form1″>Form1<br>
<input type=”radio” name=”form” value=”form2″>Form2<br>
<input type=”radio” name=”form” value=”form3″>Form3</td>
</tr>
<tr>
<td colspan=”2″><br><br><div align=”right”><input TYPE=”SUBMIT” VALUE=”Submit”> <input TYPE=”RESET”
VALUE=”Reset”></div></td>
</tr>
</table>