troubleshooting Question

How to get id of selected radio button asp

Avatar of cjJosephj
cjJosephj asked on
JavaScriptASP
6 Comments1 Solution898 ViewsLast Modified:
Hi,

Basically I have dynamic radio buttons and I am trying to display a dropdown based on the selection of the radio button. Currently I have 4 radio buttons so when I try and get the ID of  the selected radio button I get the ID for all the radio buttons (1,2,3.4) instead of the ID of the selected one so if the second radio button was selected I should only get ID 2. I am not sure what to do as I put a hidden field to pick up the value of the selected radio button but this brings back the incorrect results.
My code for that section is below without the new dropdown I am trying go create as I need to pass the value of the ID into a stored procedure.

Thanks in advance

<script Language="Javascript" src="JavascriptFunctions.js"></script>
<form name="form1" method="Post" action="Page.asp?v=<%=V%>">
 
<table cellpadding="0" cellspacing="0" border="0" class="DarkBoldText" width="900">
<tr><td width="50">V:</td><td width="590" class="NormalText"><%=V%></td><td><input type="button" value="Back" onclick="Javascript:history.back();"></td></tr>
 
</table>
 
<table cellpadding="0" cellspacing="0" border="0" class="NormalText" width="900">
<tr height="10"><td colspan="3"></td></tr>
<tr>
</tr>
<tr height="5"><td colspan="3"></td></tr>
 
<%
 
if Status 1 then
	QCount=0
	SQLString="uspQuery_GetQuestions " & 1
	set rs2=adoConn.Execute(SQLString)
	do until rs2.eof
		QCount=QCount + 1
		if Status = "1" then
			if len(Request.Form("QQuestion" & QCount)) > 0 or len(Request.Form("QueryTypes" & QCount)) > 0 then
				aQ(QCount)="1"%>
				<tr bgcolor="#FFFFF0" height=25 valign="bottom" >
				<td valign="bottom"><%=Replace(rs2("text"), "/", "'")%></td><td></td><td></td><td></td></tr>
				<tr bgcolor="#FFFFF0">
				<td valign="top">
				<%set rs3=adoConn.Execute("storedprocedure " & Status)%>
					<SELECT id="Types<%=QCount%>" name="Types<%=QCount%>" class="NormalText">
					<OPTION value"0">Select a query...</OPTION>
					
				<%
				do until rs3.eof%>
					<OPTION value="<%=rs3("ID")%>"><%=Replace(rs3("text"), "/", "'")%></OPTION>
					<%rs3.movenext
				loop%>
				</SELECT></td>
			
			<%end if
			
		else%>
			<tr bgcolor="#FFFFF0" height=25>
			<td><%=Replace(rs2("text"), "/", "'")%></td><td></td><td></td><td><INPUT type="radio" id="Question<%=rs2("Id")%>" name="Question<%=rs2("Id")%>" value="1" class="NormalText" i></td>
			
			<script type="text/javascript">radioButtons()</script>
				
			</tr>
			<tr height="7"><td colspan="3"></td></tr>
		<%end if
		rs2.movenext
	loop
end if
<tr><td colspan=4 align="right"><INPUT type="button" value="Submit2" id=button2 name=button2 onclick="javascript:Query()" style="Cursor:hand"></td></tr>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros