0

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

2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by Ankita B
0

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.

0

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

0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.