Bueno la forma más dinámica que pude lograr es esta, gracias a la idea que me diste caricatos
Código HTML:
Ver original<script type="text/javascript"> function chkAccessCheckbox(){
var i = 1;
while(true){
var access = document.getElementsByName('access[' + i + '][]');
if(access.length == 0) return false;
for (var x in access) {
if(access[x].checked){
return true;
}
}
i = i << 1;
}
}
<form action="#" onsubmit="return chkAccessCheckbox();"> <input type="checkbox" name="access[1][]" value="1" /> <input type="checkbox" name="access[1][]" value="2" /> <input type="checkbox" name="access[1][]" value="4" /> <input type="checkbox" name="access[1][]" value="8" /> <input type="checkbox" name="access[1][]" value="16" />
<input type="checkbox" name="access[2][]" value="1" /> <input type="checkbox" name="access[2][]" value="2" /> <input type="checkbox" name="access[2][]" value="4" /> <input type="checkbox" name="access[2][]" value="8" /> <input type="checkbox" name="access[2][]" value="16" />
<input type="checkbox" name="access[4][]" value="1" /> <input type="checkbox" name="access[4][]" value="2" /> <input type="checkbox" name="access[4][]" value="4" /> <input type="checkbox" name="access[4][]" value="8" /> <input type="checkbox" name="access[4][]" value="16" />
<input type="checkbox" name="access[8][]" value="1" /> <input type="checkbox" name="access[8][]" value="2" /> <input type="checkbox" name="access[8][]" value="4" /> <input type="checkbox" name="access[8][]" value="8" /> <input type="checkbox" name="access[8][]" value="16" />