I’m trying to validate a Radio-selection, in a loop.
Is it my loop that’s wrong,
or the way I reference the Form?
[CODE]<html>
<head><title>TestFormRadio</title>
<script type=”text/javascript>
function checkMonthChoice()
{
var check = 0; // fields 0-5 = Months 1-6
for ( var k=0 ; k<6 ; k++ )
if ( document.this.field[k].checked )
check = k+1; // save monthNum1
if ( !check )
{
alert (“No Month selected”);
return false;
}
return check;
}
</script>
</head><body>
<form name=’edit’ method=’post’
onsubmit=’return chekMonthChoice(this)’
action=’http://localhost/cgi-bin/file_boxes’>
<table><tr>
<td colspan=’3′><h3>Which Month?</h3></td>
</tr><tr>
<td><input type=’radio’ value=1 name=’emnth’>January</td>
<td><input type=’radio’ value=2 name=’emnth’>February</td>
<td><input type=’radio’ value=3 name=’emnth’>March</td>
</tr><tr>
<td><input type=’radio’ value=4 name=’emnth’>April</td>
<td><input type=’radio’ value=5 name=’emnth’>May</td>
<td><input type=’radio’ value=6 name=’emnth’>June</td>
</tr><tr>
<td><input type=’reset’ value=’Reset’></td>
<td> </td>
<td><input type=’submit’ value=’Submit Month’></td>
</tr></table>
</form>
</body></html>
Thanks, in advance, for any help.
JimJ