Hi all,

I'm using a form validation script that alerts fine for all fields, except when adding in any radio buttons.

Can anyone see why this won't work pls, I'm outa ideas. I've tried:

if(document.myform.transport.checked == "")

also,

if(document.myform.transport.checked)



script snipped to just 2 checks for brevity ...

<SCRIPT LANGUAGE="JavaScript">
function checkFields() {
missinginfo = "";
if(document.myform.name.selectedIndex == "") {
missinginfo += "\n - Name";
}
if(document.myform.transport.checked == "") { // This validation not working
missinginfo += "\n - Transport";
}
if (missinginfo != "") {
missinginfo ="\n" +
"The following was incomplete: \n" +
missinginfo + "\n" +
"\nPlease enter and re-submit";
alert(missinginfo);
return false;
}
else return true;
}
</script>

Other info:

<FORM NAME="myform" ACTION="next.html" onSubmit="return checkFields();" METHOD=POST>

<INPUT ID="RadioButton1" TYPE=RADIO NAME="transport" VALUE="Auto">Auto</P>
<INPUT ID="RadioButton2" TYPE=RADIO NAME="transport" VALUE="Train">Train</P>

Thanks for reading.