I am trying to write a page that requires a Pass/Fail for conditions that are done everyday and then posting them to a database. The problem I'm having is the validation of the checkboxes. Find the code below:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled 1</title>
<style type="text/css">
#form1 {
	text-align: left;
	width: 550px;
	margin-left: 0px;
}
</style>
</head>
<script language="javascript">
function validate()
{
var chks = document.getElementsByName('dailycheck');
var checkCount = 0;
for (var i = 0; i < chks.length; i++)
{
if (chks[i].checked)
{
checkCount++;
}
}
if (checkCount < 8)
{
alert("Please select Pass or Fail for each.");
return false;
}
return true;
}
</script>
<body style="margin-left: 350px; margin-top: 60px">

<form name="form1" onSubmit="return validate()">
	<table style="width: 81%; text-align: left">
		<tr>
			<td style="width: 285px">Called 512-483-9014</td>
			<td>
			<input name="dailycheck" type="checkbox" value="pass" style="width: 23px" />Pass
			<input name="dailycheck" type="checkbox" value="fail" style="width: 23px"/>Fail		
			</td>
		</tr>
		<tr>
			<td style="width: 285px">Called 512-381-0115</td>
			<td>
			<input name="dailycheck" type="checkbox" value="pass" style="width: 23px" />Pass
			<input name="dailycheck" type="checkbox" value="fail" style="width: 23px" />Fail
			</td>
		</tr>
		<tr>
			<td style="width: 285px">Checked VLPortal for Calls since Midnight</td>
			<td>
			<input name="dailycheck" type="checkbox" value="pass" style="width: 23px" />Pass
			<input name="dailycheck" type="checkbox" value="fail" style="width: 23px" />Fail
			</td>
		</tr>
		<tr>
			<td style="width: 285px">&nbsp;</td>
			<td>
			<input name="dailycheck" type="checkbox" value="pass" style="width: 23px" />Pass
			<input name="dailycheck" type="checkbox" value="fail" style="width: 23px" />Fail
			</td>
		</tr>
	</table>
	<table style="width: 81%; text-align: left">
		<tr>
			<td style="width: 285px">&nbsp;</td>
			<td>
			<input name="dailycheck" type="checkbox" value="pass" style="width: 23px" />Pass
			<input name="dailycheck" type="checkbox" value="fail" style="width: 23px" />Fail
			</td>
		</tr>
		<tr>
			<td style="width: 285px">&nbsp;</td>
			<td>
			<input name="dailycheck" type="checkbox" value="pass" style="width: 23px" />Pass
			<input name="dailycheck" type="checkbox" value="fail" style="width: 23px" />Fail
			</td>
		</tr>
		<tr>
			<td style="width: 285px">&nbsp;</td>
			<td>
			<input name="dailycheck" type="checkbox" value="pass" style="width: 23px" />Pass
			<input name="dailycheck" type="checkbox" value="fail" style="width: 23px" />Fail
			</td>
		</tr>
		<tr>
			<td style="width: 285px">&nbsp;</td>
			<td>
			<input name="dailycheck" type="checkbox" value="pass" style="width: 23px" />Pass
			<input name="dailycheck" type="checkbox" value="fail" style="width: 23px" />Fail
			</td>
			</table>
	<p style="width: 52px; margin-left: 280px">
	<input name="Submit" type="submit" value="Formsubmit1" style="text-align: center; margin-left: 0px" /></p>
	<p>&nbsp;</p>
</form>

</body>

</html>

Multiple checkbox validation is new to me and I'm just needing some help in the correct direction to go. Can anyone assist me please?

Thank you

Hi dougancil
Maybe radiobuttons will serve your purpose better - the code above allows checking both "pass" and "fail" for each condition.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.