silencer01
11-23-2003, 05:58 PM
Hi All,
I have a form with 3 radio buttons which, by default none are checked. I have the validation code that works fine although i need to be able to submit the form a go to the confirmation page without passing URL variables.
Here is the code that works fine (but uses URL variables).
<html>
<head>
<script type="text/javascript" language="javascript">
function radio_validate(grp)
{ var isOK = false;
for (var i=0; grp[i]; i++)
if (grp[i].checked)
{ isOK = true; break; }
if (!isOK) alert('Please select one of the answers');
return isOK; }
</script>
</head>
<body>
<form name="form" action="confirm.cfm">
<input name="q1" type="radio">1<br>
<input name="q1" type="radio">2<br>
<input name="q1" type="radio">3
<input type="submit" name="submit" value="submit" onclick="return radio_validate(form.q1)?form.submit():false;">
</form>
</body>
</html>
Does anyone know how to validate the form without using URL variables?
Thanks in advance!
I have a form with 3 radio buttons which, by default none are checked. I have the validation code that works fine although i need to be able to submit the form a go to the confirmation page without passing URL variables.
Here is the code that works fine (but uses URL variables).
<html>
<head>
<script type="text/javascript" language="javascript">
function radio_validate(grp)
{ var isOK = false;
for (var i=0; grp[i]; i++)
if (grp[i].checked)
{ isOK = true; break; }
if (!isOK) alert('Please select one of the answers');
return isOK; }
</script>
</head>
<body>
<form name="form" action="confirm.cfm">
<input name="q1" type="radio">1<br>
<input name="q1" type="radio">2<br>
<input name="q1" type="radio">3
<input type="submit" name="submit" value="submit" onclick="return radio_validate(form.q1)?form.submit():false;">
</form>
</body>
</html>
Does anyone know how to validate the form without using URL variables?
Thanks in advance!