...

View Full Version : How to read values from Radio Buttons



omare
08-07-2002, 09:32 PM
Hi,

I'm new to java.

I'm trying to submit a URL from a Form, the user has to choose between 3 different URLs that are displayed as radio buttons.
So the user can only choose one of them.

After that I'd like to pass the selected button's value to a function which will read the value and append that string to another string to form a complete URL.

I'd appreciate it if any one could help


Regards,

Omare

beetle
08-07-2002, 09:38 PM
Well, if the form's submit method is GET then you don't need to use a function. The value for the radio button object will already appear in the URL as part of the querystring.

omare
08-07-2002, 09:45 PM
Thanx,

it is actually a GET, but I append the 2 strings before submitting the form, so I send the complete URL like this

top.location.href = './'+R1+D2+'.htm';

where R1 is the value of the radio button, and D2 is the rest of the URL

how do I call the radio object?, thatīs whatīs still unclear to me.
I don't know how to assign the button's value to the R1 variable.

I know I must look like a complete idiot to you. I'm really ignoratn at this.

beetle
08-07-2002, 09:52 PM
var R1 = document.forms[0].radio1.value;

<form>
<input type="radio" value="choice1" name="radio1" />
<input type="radio" value="choice2" name="radio1" />
<input type="radio" value="choice3" name="radio1" />
</form>

omare
08-07-2002, 10:04 PM
That did it!!

thank you so much.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum