I am trying to write some Javascript to determine if a check box is select and if it is not then the 2 input boxes must have values. It is not working. No error messages but nothing is returned.
<script type="text/javascript" language="JavaScript">
<!--
function checkCheckBoxes(form) {
if (
form.IsComment.checked == false &&
form.ChoiceValues.length == 0 || form.ChoiceValues.value == null &&
form.ChoiceStrings.length == 0 || form.ChoiceStrings.value == null)
{
alert ('You didn\'t choose any of the checkboxes!');
return false;
} else {
return true;
}
}
//-->
</script>
<input type=submit name="Action" value="Add Question" onClick="checkCheckBoxes(this);">
<script type="text/javascript" language="JavaScript">
<!--
function checkCheckBoxes(form) {
if (
form.IsComment.checked == false &&
form.ChoiceValues.length == 0 || form.ChoiceValues.value == null &&
form.ChoiceStrings.length == 0 || form.ChoiceStrings.value == null)
{
alert ('You didn\'t choose any of the checkboxes!');
return false;
} else {
return true;
}
}
//-->
</script>
<input type=submit name="Action" value="Add Question" onClick="checkCheckBoxes(this);">