TrueBlue
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")
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")
ASKER
Tim,
Shouldn't the Session be location as well?
Thank you in advance.
Shouldn't the Session be location as well?
Thank you in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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