I have 2 checkboxes with the same name and different values. I have a validation script which checks various form entries (it can be used on any form). I am trying to check that at least one of the values has been checked.

Code:
if(type=='tf'){
		var oneChecked=false
		for(i=0;i<document.getElementById(objName).length;i++){
			if(document.getElementById(objName)[i].checked==true){
				oneChecked=true
				break;
			}
		}
		if(oneChecked==false){
			errors=errors+label+' must be selected\n';
			return;
		}
	}
Here is the section of code to do this. For some reason the length is comeing back as undefined. I have tested document.getElementById(objName) and it comes back as an object.

What is going wrong?

cheers

monkey