...

View Full Version : validating fields with radio buttons



florida
12-18-2006, 04:31 PM
I have fields that need to be validated and the below checks all my radio button selections so If I check a radio button the unchecked ones for that field are still validated. Please advise how I can check radio buttons so it doesnt still show "Field value is required" even after I checked the button for a field:


fuction val()
{
var regexp = /^.*?_theWord$/;
for (var i=0;i<document.myform.elements.length;i++) {
if (regexp.test(document.myform.elements[i].name) {
if(!document.myform.elements[i].checked)
{
alert("Field value is required");
return false;
}
}
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum