thispage.jsp displays user id and name in a table format with radiobutton attached to each row....

while(enum.hasMoreElements())
{
	String upid = 	(String)enum.nextElement();
  	String upname = (String)enum.nextElement();
%>
	<tr>
	
	<td>
	<input type="radio" name="idradio" selected="false"  value="<%= upid %>" />
	</td>

	<td>
	<% out.println(upid);%>  </td>

	<td>
	<%out.println(upname);%> </td>
	</tr>
<%}

%>

nextpage.jsp needs to display selected id and name value in two separate textboxes...

<%  
	String id1 = request.getParameter("idradio");
    	String name1= request.getParameter("upname");
 %> 


<input type="textbox" name="AQC1_UID" value="<%= id1 %>" >
<input type="textbox" name="AQC1_USER_NAME" value="<%= name1%>">

I am able to get user id value but dont know how to take corresponding name value as radio button value is user id..

please help..thx

Recommended Answers

All 3 Replies

You should change this

while(enum.hasMoreElements())
{
	String upid = 	(String)enum.nextElement();
  	String upname = (String)enum.nextElement();
%>
	<tr>
	
	<td>
	<input type="radio" name="idradio" selected="false"  value="<%= upid %>" />
	</td>

	<td>
	<% out.println(upid);%>  </td>

	<td>
	<%out.println(upname);%> </td>
	</tr>
<%}

%>

to this

<input type="hidden" name="uptime" value="" >

<%
while(enum.hasMoreElements())
{
	String upid = 	(String)enum.nextElement();
  	String upname = (String)enum.nextElement();
%>
	<tr>
	
	<td>
	<input type="radio" name="idradio" selected="false"  value="<%= upid %>" onclick="javascript:myForm.elements['upname']='<%= out.println(upname);%>' " />
	</td>

	<td>
	<% out.println(upid);%>  </td>

	<td>
	<%out.println(upname);%> </td>
	</tr>
<%}

%>

This would assign selected upname to the hidden field upname where myForm is the id the your form.

hey thx for the reply but its still not taking the value..onlu user id is being diaplayed..user name comes as blank..

perhaps somethin needs to be changed in---

onclick="javascript:myForm.elements='<%= out.println(upname);%>' "

thx

oh don bother i figured the problem..should be written as follows..bt thx anyway..:-)

<input type="hidden" name="namerad" value="">

onClick=" javascript:finduser.namerad.value= '<%= upname %>' "

finduser is the form name.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.