Hi, I have a form that utilizes validation as most do via javascript. This form worked totaly fine until I needed to add a dynamic div now the validation doesn't work. It does work for the first dropdown but nothing there after. I always get the error saying [form object] is null or not an object. I need help trying to figure out how to access the ojects in this form. Now in my body I have a <form> and it's name is form1 and I also have another <form> around a drop down and it's name is change and it closes right after the drop down. I don't want to put all of the code here because it's lengthy but I'll put some of it here so that someone can help me figure out what's going on. <script> <!-- function validate() { //check to see if the drop down was selected. len = document.form1.program.length; //alert(document.graderrors.school.length); i = 0; chosen = "none"; for (i = 0; i < len; i++) { if (document.form1.program[i].selected) { chosen = document.form1.program[i].value //alert(document.graderrors.school[i].value); } } if (chosen == "" || chosen==0 || chosen=="none") { alert('Please select your program of study'); return false; } //Check for errors if(window.document.form1.firstname.value=='') { alert('Please fill out the First Name field'); window.document.form1.firstname.focus(); return false; } else if(window.document.form1.lastname.value=='') { alert('Please fill out the Last Name field.'); window.document.form1.lastname.focus(); return false; } ....on and on with validation now on to some of the body <body bgcolor="#000000" topmargin="0" leftmargin="0" onLoad="javascript:hide();"> <table align="center" border="0" bgcolor="#DDE324" cellspacing="0" cellpadding="0"> <tr> <td bgcolor="#20249C"> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center" valign="top" height="31" bgcolor="#20249C"> <p><img border="0" src="images/eCampuslgnew.jpg" alt="Keiser University eCampus Distance Education" width="693" height="85"><br> <font face="Verdana" size="1" color="#FFFFFF">Keiser University eCampus is the online division of Keiser University, Fort Lauderdale campus</font><b><font color="#FFFFFF" face="Verdana"><br></font> <font color="#EEEAB9" face="Verdana">Keiser University Division of Online Education Inquiry Form</font><font color="#FFFFFF" face="Verdana"><br></font></b> <font size="2" color="#EEEAB9" face="Verdana">To have an Admissions Counselor contact you, please fill out the form below</font></p> </td> </tr> </table> <form name="form1" method="post" action="process_ecampus_inquiry.php"> <input type="hidden" name="type" value="KU Website"> <table border="1" cellpadding="0" cellspacing="0" bordercolor="#20249C" width="691" id="table1"> <tr> <td bgcolor="#20249C" width="155"></td> <td bgcolor="#20249C"><span class="style19">*indicates required field</span></td> </tr> <tr bgcolor="#DCDCDC"> <td valign="top" nowrap="nowrap" align="right" width="155"><span class="style21"><font size="1">Program of Study*</font></span></td> <td nowrap="nowrap" width="530"> <form name="change"><span class="style21"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><select id="program" tabindex="2" onChange="reveal(this.value);" name="program"> <option value="">Select A Program...</option> <option value="">+ Master's Degrees</option> <option value="MBA"> -- Master's in Business Administration</option> <option value="">+ Bachelor Degrees</option> <option value="ACCBA"> -- Accounting, BA</option> <option value="BABA"> -- Business Administration, BA - Management</option> <option value="BABA-FIN"> -- Business Administration, BA - Finance</option> <option value="BABA-HRM"> -- Business Administration, BA - Human Resources</option> <option value="BABA-IBT"> -- Business Administration, BA - Intl. Business</option> <option value="BABA-MKT"> -- Business Administration, BA - Marketing</option> <option value="BACJ"> -- Criminal Justice, BA</option> <option value="BAHSA"> -- Health Services Administration, BA</option> <option value="BSHS"> -- Health Science, BS</option> <option value="BAHS"> -- Homeland Security, BA</option> <option value="BSITM"> -- Information Technology Management, BS</option> <option value="BALS"> -- Legal Studies, BA</option> <option value="MISBA"> -- Management Information Systems (MIS), BS</option> <option value="BSN"> -- Nursing, RN to BSN</option> <option value="" selected="selected">+ Associate Degrees</option> <option value="ACCAS"> -- Accounting, AA</option> <option value="CJAA"> -- Criminal Justice, AA</option> <option value="ITAS"> -- Information Technology, AS</option> <option value="HSAAA"> -- Health Services Administration, AA</option> <option value="HS"> -- Homeland Security, AA</option> <option value="MAAS"> -- Medical Assisting, AS</option> <option value="PLAA"> -- Paralegal Studies, AA</option> </select></font></span></form> Now this is the div in case this is need for whatever reason <div id="realtooltip" style="display: inline"> <table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#20249C" bgcolor="#DCDCDC" id="table2"> <tbody> <tr> <td align="middle" bgcolor="white" colspan="2"> <div align="center" class="style24"><span class="style23"><strong><font size="2">Must be a U.S. licensed RN to qualify for our nursing program.</font></strong><font size="2"><br> <span class="style1">Please answer the following if you are interested in our Bachelor of Science in Nursing program.</span><br> <br> Nursing Prerequisites</font></span></div> </td> </tr> <tr> <td></td> <td nowrap="nowrap" width="100%"></td> </tr> <tr> <td colspan="2"> <table width="350" border="0" id="table3"> <tbody> <tr> <td><span class="style21"><font size="1">Do you possess a current, unrestricted license to practice as a registered nurse in at least one U.S. state, including the state in which a clinical will be completed?</font></span></td> <td valign="top" nowrap="nowrap"><span class="style21"><font size="1"> </font> <font size="1" face="Verdana, Arial, Helvetica, sans-serif"><input id="licensed" type="hidden" name="licensed"></font></span> <table width="138" border="0" cellspacing="0" cellpadding="0" id="table4"> <tr> <td width="47"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><input id="radio" onClick="form.licensed.checked=false;form.licensed.value='yes';" type="radio" value="yes" name="licensed"></font></td> <td width="32"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">yes </font></td> <td width="27"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><input id="radio2" onClick="form.licensed.checked=false;form.licensed.value='no';" type="radio" value="no" name="licensed"></font></td> <td width="32"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">no</font></td> </tr> </table> <span class="style21"><font size="1"> </font></span></td> </tr> <tr> <td><span class="style21"><font size="1">Are you a graduate of an associate degree program or a diploma nursing program?</font></span></td> <td valign="top" nowrap="nowrap"><span class="style21"><font size="1"> </font> <font size="1" face="Verdana, Arial, Helvetica, sans-serif"><input id="gpa" type="hidden" name="gpa"></font></span> <table width="138" border="0" cellspacing="0" cellpadding="0" id="table5"> <tr> <td width="47"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><input id="radio3" onClick="form.gpa.value='yes';form.gpa.checked=false;" tabindex="30" type="radio" value="yes" name="gpa"></font></td> <td width="32"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">yes </font></td> <td width="27"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><input id="radio4" onClick="form.gpa.value='no';form.gpa.checked=false;" tabindex="31" type="radio" value="no" name="gpa"></font></td> <td width="32"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">no</font></td> </tr> </table> </td> </tr> <tr> <td><span class="style21"><font size="1">Are you a U.S. citizen or a national or permanent resident of the U.S.?</font></span></td> <td valign="top" nowrap="nowrap"><span class="style21"><font size="1"> </font> <font size="1" face="Verdana, Arial, Helvetica, sans-serif"><input id="uscitizen" type="hidden" name="uscitizen"></font></span> <table width="138" border="0" cellspacing="0" cellpadding="0" id="table6"> <tr> <td width="47"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><input onClick="form.uscitizen.value='yes';form.uscitizen.checked=false;" tabindex="32" type="radio" value="yes" name="uscitizen"></font></td> <td width="32"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">yes </font></td> <td width="27"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><input id="radio5" onClick="form.uscitizen.value='no';form.uscitizen.checked=false;" tabindex="33" type="radio" value="no" name="uscitizen"></font></td> <td width="32"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">no</font></td> </tr> </table> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <layer></layer> </div> Code (markup):
Try replacing the portion of code which validates the drop-down menu with the following: //check to see if the drop down was selected. var i = document.form1.program.selectedIndex; if (i < 0) { alert('Please select your program of study'); return false; } chosen = document.form1.program.options[i].value; Code (markup):