This should be simple but driving me nuts. I have a simple validation function that basically just makes sure values are entered or selected. Here is the function:
Here is the html
This works fine in Firefox but not matter what I do I can't get the dropdown box to work in IE7. Whatever I choose the select a state error message comes up.
Any ideas?
Thanks
Code:
function validate_form()
{
if ( document.contact_form.cfirst_name.value == "" )
{
alert ( "Please fill in a first name." );
return false;
}
......
else if (document.contact_form.state.options[document.contact_form.state.selectedIndex].value =="")
{
alert ( "Please select a state." );
return false;
}
.......
else
{
return true;
}
}
Code:
<form name="contact_form" action="step3.php" method="post" onsubmit="return validate_form();">
.....
<select name="state">
<option></option>
<option>AK</option>
<option>AL</option>
<option>NE</option>
<option>SC</option>
<option>TX</option>
<option>UT</option>
</select>
....
</form>
Any ideas?
Thanks