Radio button problem
hello , i'm doing a survey in asp which is connected to ms sql server , i've tested my code and its working , i'm trying to show warnning msg to the user , when ever the user forgets to vote for any service for example reservation , and byt the reservation has 3 values .But my code is not working in the way i wanted to, it gives me a warnning msg even though if i select one of the values! , can any one help me out
<html>
<titl></title>
<head>
<SCRIPT LANGUAGE="VBScript">
<!--
sub validat()
Dim v
For n = v to Document.frm.reservation.length - 1
If not Document.frm.reservation(v).checked Then
msgbox "Please vote the reservation"
exit for
end if
if document.frm.reservation(v).checked then
frm.submit
end if
exit for
Next
frm.submit
end sub
//-->
</script>
</head>
<body>
<form name="frm" method=post action="vote.asp">
<input type="radio" name="reservation" value="bad">bad
<input type="radio" name="reservation" value="good">good
<input type="radio" name="reservation" value="Excellent">Excellent
<input type="submit" value="submit" onclick="validat">
</form>
</body>
</html>
</body>
|