onchange event in radio button

M

Matt

I have radio buttons on a form, and when the user makes the selection, it
will trigger the event and send the form to the web server and print the
selected value. In Case 1, I just use submit button, without any event
handling, and it works fine.

However, in Case 2, which is what I am trying to do, it has the problem that
even when the user clicks the button, it won't show the value automatically.
But wait until user selects another choice.

Any ideas? Thanks!

----------------------------------------------------------------------------
-----
Case 1:
<%
If (Request.Form("submitbutton") = "submit here") Then
Response.Write(Request.Form("radiogroup"))
End If
%>

<html>
<body>
<form action="radiobuttontest.asp" name="myform" method="post">
<P>Choice 1<input type="radio" name="radiogroup" value="choice1">
<P>Choice 2<input type="radio" name="radiogroup" value="choice2">
<P>Choice 3<input type="radio" name="radiogroup" value="choice3">
<P><input type="submit" name="submitbutton" value = "submit here">
</form>
</body>
</html>

----------------------------------------------------------------------------
-----
Case 2:

<%
Response.Write(Request.Form("radiogroup"))
%>

<html>
<body>
<form action="radiobuttontest1.asp" name="myform" method="post">
<P>Choice 1<input type="radio" name="radiogroup" value="choice1"
onchange="document.myform.submit()">
<P>Choice 2<input type="radio" name="radiogroup" value="choice2"
onchange="document.myform.submit()">
<P>Choice 3<input type="radio" name="radiogroup" value="choice3"
onchange="document.myform.submit()">
</form>
</body>
</html>
 
S

Stuart Palmer

not an asp question would be best asked in a JS NG , but try onclick.
onchange only works if you are changing the value of the field.

Stu
 
S

Stuart Palmer

Also, do a noscript tag with a submit button in, some users don't have JS so
would need to submit the form to get it to work.

Stu
 

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

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top