|
Forms - Radio Buttons (by John Kauffman)
All of your user input objects in a form must have their own
unique name which will be the label that the browser will assign to them when passing the
data to ASP. The exceptions are radio buttons. Since only one piece of information will be
passed to ASP from a set of radio buttons, they all get the same name. HTML requires that
one of the buttons is selected by default, the one indicated by the CHECKED command. It is
important to understand that the browser will send back to ASP the name and the value of
the one button which is selected by the user. The browser will NOT send back the text
which is associated with the button. For the example above, if the user checked on the
button with the text New York City, then ASP would receive City=NY.
filename=/learn/test/FormRadio.asp
<html><head>
<TITLE>formRadio.asp</TITLE>
</head><body bgcolor="#FFFFFF">
<form action="FormRadiorespond.asp" method="post">
<p><b>Radio Buttons </b> example</p>
<p>Which Regional Office will you be visiting?</p>
<input TYPE="radio" NAME="City" VALUE="NY">New York City
<input TYPE="radio" NAME="City" VALUE="LA">Los Angeles
<input TYPE="radio" NAME="City" VALUE="SV" CHECKED>Savannah
<br><input type="submit" value="choose a city">
</form>
</body></html>
The responder looks like:
filename=/learn/test/FormRadiorespond.asp
<html><head>
<TITLE>formradiorespond.asp</TITLE>
</head><body bgcolor="#FFFFFF">
<%myCity = request.form("City")
Select Case ucase(MyCity)
case "NY"
response.write "New York meeting is on Jan 3"
case "LA"
response.write "LA meeting meeting is on Jan 15"
case "SV"
response.write "Savannah meeting is on Jan 20"
End Select%>
</body>
</html>
|