View Full Version : help with radio button validation

04-28-2004, 03:11 PM
Can someone help me??

I have an asp form with 4 radio buttons and i want to have one button chosen before the form is submitted. I have this code snippet but if I do not check a button, the form still submits:
<SCRIPT language="JavaScript">

function Validate() {

if ((document.contest.Website.check == true) || (document.contest.Radio.checked == true) || (document.contest.Print.checked == true || (document.contest.Other.checked == true) {
return true;
else {
return false;



<form method="post" action="contest.asp" name="contest" onSubmit="return Validate()">

<input type="radio" value="1" name="q1>Website
<input type="radio" value="1" name="q1">Radio
<input type="radio" value="1" name="q1">Print Ad
<input type="radio" value="1" name="q1">Other

How do I get the form to give a message stating that a button needs to be checked and to not submit if a button is not checked??

Can someone help me???

Willy Duitt
04-28-2004, 03:25 PM
Try searching the forum. Radio button validation is an often asked and answered question and a search should return numerous results, any of which should provide the solution. ;)