I am working on a form for my Web page and I am trying to do some validation for checkboxes. I want to send an alert if no checkboxes are selected after the user clicks the submit button. I have written a piece of code but it doesn't seem to be working. I would take all of the advice I can get. Here is what I have written so far.
function checkCheckBoxes(form)
{
if (
form.checkbox.checked == false)
{
alert ("You must select a checkbox!")
return false;
} else {
return true;
}
}
<form method="post" id=form name=form onsubmit="return checkCheckBoxes(this);">
Thank you!!
function checkCheckBoxes(form)
{
if (
form.checkbox.checked == false)
{
alert ("You must select a checkbox!")
return false;
} else {
return true;
}
}
<form method="post" id=form name=form onsubmit="return checkCheckBoxes(this);">
Thank you!!