Link to home
Start Free TrialLog in
Avatar of TrueBlue
TrueBlueFlag for United States of America

asked on

Trying to only allow one radio button to be clicked and saved per form session

I am trying to save the value of the following radio buttons (only one should be able to be pressed per form). If the user enters the wrong security code they are returned and the one selected should still be selected.

Form Processing Page:

 <input type="radio" checked name="Home" value="V1" <% If Session("Home") = "V1" then Response.Write "selected" %>>Home
   <input type="radio" name="Business" value="V2" <% If Session("Business") = "V2" then Response.Write "selected" %>>Business

Email Processing Page:

 Session("Home") = Request("Home")
 Session("Business") = Request("Business")
Avatar of TimCottee
TimCottee
Flag of United Kingdom of Great Britain and Northern Ireland image

Hi TrueBlue,

To link radio buttons, you should specify the same "Name" property for each radio button:

 <input type="radio" checked name="Location" value="V1" <% If Session("Home") = "V1" then Response.Write "selected" %>>Home
   <input type="radio" name="Location" value="V2" <% If Session("Business") = "V2" then Response.Write "selected" %>>Business

You can then get the value from the request.form("Location") and set your session variables dependent on this.

Tim Cottee
Avatar of TrueBlue

ASKER

Tim,

Shouldn't the Session be location as well?

Thank you in advance.
ASKER CERTIFIED SOLUTION
Avatar of TimCottee
TimCottee
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial