Help with Radio in Forms

06-02-2002, 05:17 AM

Really stupid one, but I cannot see my way through!

I have a form, which will be submitted to an asp page. I want to check that one of 2 radio buttons have been selected in vbscript before the submit takes place.

It is easy enough to check the contents of a text box, by using FORMNAME.TEXTBOXNAME.VALUE

This does not work with radio buttons. Any idea how one tests whether the radio buttons have been pushed?

Example Code for the Form follows...

<form action="total.asp" name=quest id=quest method=post>
<P align=center>Do you drink Coffee?</P>
<p align=center><input id=t name=t type=textbox></p>
<P align=center><INPUT id=yesno name=yesno type=radio value=1>Yes</P>
<P align=center><INPUT id=yesno name=yesno type=radio value=2>No</P>
<P align=center><INPUT id=subm type=button value="Vote" name = subm ></P>

On clicking on the button I hop to the vbscript, which is where I need to insert the correct code to get a value of 1 or 2 back from the form before sending to ASP page.

Any Ideas?

06-02-2002, 06:36 AM
document.formname.radioname[0].value is the first one. [1] is
the second and so on.
This is javascript - not exactly sure how it would look in vbscript
but maybe...

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum