Radio Buttons

G

Guest

<INPUT TYPE=RADIO NAME="CategoryName" VALUE="TEST"CHECKED>
TEST
The code above is one of a number of entries for radio buttons used to test
a form. The form works. The form is used to search a database and the user
can enter search words. My question: is there a way to make the last button
that the user selects remain checked rather than it reverting to the default
while the user has the form open. At present if the user wants to do anothe
search he has to click the radio button again. Thanks for any replies.
 
S

Stefan B Rusynko

You need to do it server side and radio buttons are normally are used in pairs
(on/off or true/false as 1/0 values)

<%
If Request.Form("CategoryName")=1 Then
'Use User Selected state
strStateOn="Checked"
strStateOff="" 'empty string
Else
'Use Default state
strStateOn="" 'empty string
strStateOff="Checked"
End If
%>
<form method="post" action="<%=Request.ServerVariables("SCRIPT_NAME")%>">
SELECT an Option:<INPUT TYPE=RADIO NAME="CategoryName" VALUE="1" <%=strStateOn%>> Test ON
<INPUT TYPE=RADIO NAME="CategoryName" VALUE="0" <%=strStateOff%>> Test OFF
<input type="submit" value="GO"></form>


In your processing you can change the value you need to use in your query or DB of CategoryName same way






| <INPUT TYPE=RADIO NAME="CategoryName" VALUE="TEST"CHECKED>
| TEST
| The code above is one of a number of entries for radio buttons used to test
| a form. The form works. The form is used to search a database and the user
| can enter search words. My question: is there a way to make the last button
| that the user selects remain checked rather than it reverting to the default
| while the user has the form open. At present if the user wants to do anothe
| search he has to click the radio button again. Thanks for any replies.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top