954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

table with radio button and two coloumns

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

Ankita B
Light Poster
49 posts since Jan 2008
Reputation Points: 12
Solved Threads: 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.

Shereef
Newbie Poster
1 post since Mar 2008
Reputation Points: 10
Solved Threads: 1
 

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['upname']='<%= out.println(upname);%>' "

thx

Ankita B
Light Poster
49 posts since Jan 2008
Reputation Points: 12
Solved Threads: 0
 

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

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

finduser is the form name.

Ankita B
Light Poster
49 posts since Jan 2008
Reputation Points: 12
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You