x comodità parto da pippo0[]
codice:
<html>
<head>
<title></title>
<script type="text/javascript">
function valida_checkbox(f){
var gruppi=["foto", "inquadratura", "soggetto", "immagine"]
for(var q=0;q<gruppi.length;q++){
var segnato=false
for(var k=0;k<f.elements['pippo'+q+'[]'].length;k++){
if(f.elements['pippo'+q+'[]'][k].checked) segnato=true;
}
if(!segnato){
alert('non hai segnato alcun checkbox del gruppo "'+gruppi[q]+'"!')
return false
}
}
return true
}
</script>
</head>
<body>
<form onsubmit="return valida_checkbox(this)">
foto
<input type="checkbox" name="pippo0[]" value="a" />a
<input type="checkbox" name="pippo0[]" value="b" />b
<input type="checkbox" name="pippo0[]" value="c" />c
<hr />
inquadratura
<input type="checkbox" name="pippo1[]" value="a" />a
<input type="checkbox" name="pippo1[]" value="b" />b
<input type="checkbox" name="pippo1[]" value="c" />c
<hr />
soggetto
<input type="checkbox" name="pippo2[]" value="a" />a
<input type="checkbox" name="pippo2[]" value="b" />b
<input type="checkbox" name="pippo2[]" value="c" />c
<hr />
immagine
<input type="checkbox" name="pippo3[]" value="a" />a
<input type="checkbox" name="pippo3[]" value="b" />b
<input type="checkbox" name="pippo3[]" value="c" />c
<hr />
<input type="submit" value="invia">
</form>
</body>