Click to See Complete Forum and Search --> : Javascript not working


azwildcat4ever
January 11th, 2005, 11:31 AM
I have a Jscript checking to make sure a field is checked

The field is listed in the form of checkboxes instead on Dropdown menu. This is where the problem is occuring.. If i have a Dropdown it works but wiht the checkboxes it DOESNT NOT!!

This is the actual JScript checking to make sure the field [Position_Type] is selected

<script language="JavaScript">
<!--
//
function HSvalidate() {
var errors = '';
if (!document.frmJO.Position_Type_ID.checked) {
errors+='- You must select a Position Type.\n';
}
if (errors) alert('The following error(s) occurred:\n'+errors);
document.HS_returnValue = (errors == '');
}
//-->
</script>

<div align=center>
<form name="frmJO" method=post action="JO-Report.asp">



This is how the Field is being pulled from the database and displayed. Also look how the submit button is calling the Jscript validation


<tr><td align=right class=hometext><b>Position Type</b></td></tr>

<%
While (NOT rsPositionsTypes.EOF)
%>
<tr>
<td align=right class=hometext><b><%=rsPositionsTypes("Position_Type")%></b></td>
<td><input type=checkbox name="<%=rsPositionsTypes("Position_Type")%>" value="<%=rsPositionsTypes("Position_Type_ID")%>"></td>
</tr>

<%
rsPositionsTypes.MoveNext()
Wend
rsPositionsTypes.close
set rsPositionsTypes = nothing
%>
<tr><td colspan=2>&nbsp;</td></tr>
<tr>
<td colspan=2 align=center><input type=submit class=buttonsmall value="&nbsp;Go&nbsp;" onClick="HSvalidate();return document.HS_returnValue"></td>
</tr>