Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more - View Single Post - Select box won't validate in IE with JS
View Single Post
Old 06-25-2009, 05:20 PM   #1 (permalink)
AngieZ
Junior Member
 
Join Date: Jun 2009
Posts: 2
Default Select box won't validate in IE with JS

I am pulling out my hair here, so I really hope someone can help me. I have a PHP page that has Javascript validation. I am trying to validate a form select box. It works in Firefox but not in IE7. I have tried all sorts of things, but here is an alert that works in FF not IE, and if someone can help me with it, I can get the rest. Thanking you all in advance!

Code:
//the js part
function valid_form(frm){
    alert("month: " + frm.BirthDateMonth.options[frm.BirthDateMonth.selectedIndex].value);
}

//this is from the php form:
<select name="BirthDateMonth">
<?php
    if($BirthDateMonth != ""){
?>
        <option selected><?=$BirthDateMonth;?></option>
<?php
    }
    else {
	echo"<option>--</option>";
    }
    for($i=1; $i <= 12; $i++){
	echo"<option>$i</option>";
    }
?>
</select>
AngieZ is offline   Reply With Quote
Sponsored Links