
function Form1_Validator(theForm)
{

var alertsay = ""; // define for long lines
// alertsay is not necessary for your code,
// but I need to break my lines in multiple lines
// so the code won't extend off the edge of the page



// alert if the box is NOT checked
if (!theForm.checkbox1.checked)
{
alertsay = "The checkbox is required"
//alertsay = alertsay + "to have our Super Duper option, "
//alertsay = alertsay + "you must check the box!"
alert(alertsay);
return (false);
}

// check to see if the field is blank
if (theForm.Alias.value != "FFC4388")
{
alert("Please enter the code found in the PDF document");
theForm.Alias.focus();
return (false);
}



// require that at least one checkbox be checked
var checkSelected = false;
for (i = 0;  i < theForm.checkbox2.length;  i++)
{
if (theForm.checkbox2[i].checked)
checkSelected = true;
}
if (!checkSelected)
{
alert("Please select at least one of the \"Test Checkbox\" options.");
return (false);
}

// only allow up to 2 checkboxes be checked
var checkCounter = 0;
for (i = 0;  i < theForm.checkbox2.length;  i++)
{
if (theForm.checkbox2[i].checked)
checkCounter = checkCounter + 1;
}
if (checkCounter > 2)
{
alert("Please select only one or two of the \"Test Checkbox\" options.");
return (false);
}


// because this is a sample page, don't allow to exit to the post action
// comes in handy when you are testing the form validations and don't
// wish to exit the page
//alertsay = "All Validations have succeeded. "
//alertsay = alertsay + "This is just a test page. There is no submission page."
//alert(alertsay);
//return (false);
// replace the above with return(true); if you have a valid form to submit to
}
