Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to select only one radio button?

Status
Not open for further replies.

wvdba

IS-IT--Management
Jun 3, 2008
465
US
hi,
i have an html/hta app that i have to let users choose only one of the radio buttons for an option. is there anyway to code this so that they can only choose one radio button and not all of them?
thanks.
 
thanks so much.
that did it.
now, my problem is that how do you check to see which radio button did they checked. any ideas?
 
That would depend on what language you're using to process the form. You would best see this by checking the extension of the page that action attribute in the form tag points to. Whatever the language, it will fall of scope of this forum, since html cannot process forms. You would need to ask in one of the other fora, dedicated to the scripting language.

___________________________________________________________
[small]Do something about world cancer today: Comprehensive cancer control information at PACT[/small]
 
You give them values.

When the form is submitted you can check in your processing script which value got sent. Then you know which option was elected.

From the example in Vrag's link. If male was checked the value of your "sex" variable would be male.





----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
vacunita,
thanks. i'm beginning to get the gist of it. i'm doing this in vbscript.
Code:
<form name="form1">
GAS USAGE: 
     Full<input type="radio" value="beg_full" name="gas">
   &#190;<input type="radio" value="beg_34" name="gas"> 
   &#189;<input type="radio" value="beg_12" name="gas"> 
   &#188;<input type="radio" value="beg_14" name="gas"> 
     Full<input type="radio" value="end_full" name="gas2">
   &#190;<input type="radio" value="end_34" name="gas2">
   &#189;<input type="radio" value="end_12" name="gas2">
   &#188;<input type="radio" value="end_14" name="gas2">
</form>
i have to get two values. i'm onlye getting one value (the first one). what could be the problem, please?
thanks.



 
I see no real problem in the HTML there.

You should get one value in your "gas" variable and another in your "gas2" variable. Provided something was checked before the form was submitted.





----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
thanks vacunita,
i got it to work. i can select only one value from gas (which is fine) and only one value from gas2. now, i'm using the values of these two buttons to figure out what level of gas the vehicle had in the beginning and at the end of the trip. it worked ok.
thanks so much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top