I am having trouble with my code. I am generating a form from an oracle database. I want to validate my form when I hit submit to check to see if any of the checkboxes have been selected. If none of them have been selected, then a pop up message will occur. Right now, if I have a checkbox selected, my message box pops up (which it shouldn't) and then it goes to the my insert_employee.asp which it isn't supposed to. Any help for pointing me in the right directions would be great.

VB Code:
  1. <!-- Begin
  2. function validform() {
  3. var count
  4. count = document.AddEmployee.hidcount.value
  5. //alert (count);
  6.             for ( var i = 0; i <= count ; ++i )
  7.   if (document.AddEmployee.addempcheckbox.value == false) {
  8.   alert ("No employees were selected!");
  9.   return false;
  10.   }
  11.  return true;
  12.  }
  13.  function goSearch() {
  14.   if (validform()) {
  15.   document.AddEmployee.action = "Insert_Employee.asp"
  16.   document.AddEmployee.submit()
  17.   }
  18.  return false;
  19.  }
  20. //  End -->
  21. </SCRIPT>
  22. </HEAD>
  23. <BODY">
  24.  
  25. <% If rsEmp.BOF and rsEmp.EOF Then%>
  26. <div class="text">We did not find a match. <a href="searchemployee.asp">Search Again.</a></div>
  27. <%Else%>
  28. <%If Not rsEmp.BOF Then%>
  29.  
  30. <FORM NAME="AddEmployee" ACTION="" METHOD="post">
  31. <table border="1" cellspacing="0" cellpadding="3" valign="top" align="center" width="600">
  32.  <tr bgcolor="#C9DBF7">
  33.   <td valign="bottom" align="center" width="150">
  34.       <div class="smallboldtext">Add to Phone List</div>
  35.     </td>
  36.     <td valign="bottom" align="center" width="150">
  37.       <div class="smallboldtext">Employee Name</div>
  38.     </td>
  39.   </tr>
  40. <%
  41. count=-1
  42. Do While Not rsEmp.EOF %>
  43.   <tr bgcolor="#ffffff">
  44.     <td valign="bottom" align="center" width="150"><input type="checkbox" name="addempcheckbox">
  45.  
  46.     </td>
  47.     <td valign="bottom" align="center" width="150">Employee Name pulled from database is here
  48.  
  49.     </td>
  50.   </tr>
  51. <% rsEmp.MoveNext %>
  52. <%
  53. count=count+1
  54. Loop %>
  55. <input type=hidden value="<%=count%>" name="hidcount">
  56. </table>
  57.  
  58. <center><input type="image" src="images/submit.gif" onfiltered="goSearch()">;</center>
  59.  
  60. </FORM>
  61. <%End If%>
  62. <%End If%>
  63. <%
  64. rsEmp.Close
  65. cn.Close
  66. %>