About Jeff Allen Expertise I can answer basic to intermediate questions related to Classic ASP.I can answer Intermediate to Advanced questions CSS& HTML, and basic questions about JavaScript and Ajax. I can also answer questions related to web page accessibility under US Section 508.
Experience I have 8 years experience with HTML. I have been developing in ASP, VBScript and CSS for two years each. I also currently work as web developer.
Organizations IWA-HWG
Education/Credentials I have a BA in English with minors in Web Design and Scientific and Technical Writing
Expert: Jeff Allen Date: 7/18/2006 Subject: ASP - multiple radio buttons
Question Is the same case for radiobuttons,bcoz this simple syntax is bot working,i did this way before also.I m not able to catch a selected radiobutton value.
-------------------------
Followup To
Question -
I hav a simple 2 radio buttons when i click the first one i want to generate a diff query based on selection and vice versa.
This is the code i hav written but dont find any result
<% If Ischecked("papers") then
"do some thing"
else
"something"
End If %>
Answer -
From this snippet it looks like you are not checking for any value on the checkbox. Is the value attribute of the checkbox set like this:
If so, then what you might want to try is something like this:
<%
If request.form("lastchecked") = "papers" then
"do something"
else
"do something different"
end if
%>
Answer You should be able to do anything you want based on the value of the radio button selected because Radio buttons can be grouped. By this I mean that I can have a series of radio buttons with the same identical name, but different values. Example:
So if I check the form once it has been submitted:
<%
Dim radioValue : radioValue = Request.form("color")
'Check the value contained in radioValue
'and do something different for each value
If radioValue = "red" then
'Do something
response.writre "You chose red"
ElseIf radioValue = "green" then
'Do something
response.write"You chose green"
ElseIf radioValue = "blue" then
'Do something
response.write "You chose blue"
Else
'Show Error Message
response.write "You didn't choose a color!"
End If
%>
I do it this way (assinging a value to a variable) so i don't have to keep calling the request object which would eat up unneccessary processor cycles.
Now if you are trying to catch the value when it's (the radio button) clicked, that would be a javascript thing as that would need to be done on the client side. Remember, ASP is server side so it won't process until the form is submitted.
But by creating a "group" of radio buttons like I did above you should be able to capture what the value of the radio button is when it is selected, if you get a null, then no value was selected.