I have a form validator script that is meant to verify that at least 1 checkbox is checked.
<form name="samples" onsubmit="return validateForm();" action="process.php" method="post">
    <input type="checkbox" name="products[]" value="product-a">
    <input type="checkbox" name="products[]" value="product-b">
    <input type="checkbox" name="products[]" value="product-c">
</form>
<script>
function validateForm() {
    var counter = document.forms["samples"]["products"].value;
    if (x == null || x == "") {
        alert("Please select at least one product");
        return false;
    }
}
</script>
The code above does not seem to work.
What am I doing wrong?
 
     
    