Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to change a variable by selecting a radio button?

Status
Not open for further replies.

dz

Programmer
Jun 12, 2001
2
US
<% dim report_type %>
<table>
<tr><form>
<td>
<INPUT TYPE=&quot;radio&quot; name=&quot;report&quot; value=&quot;timecard&quot; checked>Time Card<br>
<INPUT TYPE=&quot;radio&quot; name=&quot;report&quot; value=&quot;summary&quot;>Time Summary</td>
</form></tr>
<tr><td><a href=&quot;<%= report_type %>.asp&quot;>Time Report</a></td>
</tr>
</table>
I need to change the reporttype variable based on the value of the radio button selected. How can I accomplish this???
 


dz,

You are trying to change the value when it's already displayed at the browser. You should send the value to the next ASP page and then test for &quot;timecard&quot; or &quot;summary&quot;.

reporttype = response.querystring(&quot;report&quot;)

Fengshui_1998
 
Thanks fengshui_1998, a querystring is not the answer i'm looking for but you helped me realize i'm mixing server side script with client side script. My experience is all server side! Can i manipulate a variables on the client? If so how do i call it in html code. Server side uses <% %>. Can i use something similiar to <% %>??? Thanks for the help!
 
dz,

Sorry, the above should be request.querystring(&quot;report&quot;). But since you're not using that, try this below.


<html>
<body>
<head>
<script language=&quot;javascript&quot;>
function doit() {
alert(&quot;Time Card: &quot; + document.rdo.report[0].checked)
alert(&quot;Time Summary: &quot; +document.rdo.report[1].checked)
}
</script>

</head>
<form name=&quot;rdo&quot;>

<br><INPUT TYPE=&quot;radio&quot; name=&quot;report&quot; value=&quot;timecard&quot; checked>Time Card
<br><INPUT TYPE=&quot;radio&quot; name=&quot;report&quot; value=&quot;summary&quot;>Time Summary
<br><INPUT TYPE=&quot;button&quot; name=&quot;test&quot; value=&quot;Test Me&quot; onclick=&quot;doit()&quot;></td>

</form>
</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top