Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to pass value in hyperlink instead of radio button

 
Sohaila Razali
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I've been working with radio buttons to do my selection and it works just fine. But now i intend to work with hyperlinks instead.
The following is my radio button code:

<%
int select = uim.getSelect();

mod bean = null;

List resultList = rutPage.getList(rutPage.getPageNo(),new ArrayList());

for (int i=0;i<resultList.size();i++) {
bean = (Mod) resultList.get(i);
if (bean != null) { %>
<tr id="row<%=i%>" class="TableLeftWhite" >
<td height="18"> <input type="radio" value="<%=i%>" name="optSelect" onClick="details()"></td>
</tr>
<% }
}%>

So yeah now instead of this, I would like to change the radio button to hyperlink and still be able to pass the value <%=i%> in.
I've tried the following code, bt it doesn't seem to work since value is not an attribute of a.

<td>< (something like this) a href="#" onClick="details()" name="optSelect" value="<%=i%>">link to a page</td>

So yeah is there a way for me to pass in the i value in the link?
Thnks!
 
Swastik Dey
Rancher
Posts: 1686
7
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Sohaila Razali
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there!

Thnks for the reply.

Bt I'm using onclick event instead of href since i'm using javascript: onclick="details()"

is there a way for me to do this? Thnks.
 
Swastik Dey
Rancher
Posts: 1686
7
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the detail function use the value?
 
Prajakta Acharya
Ranch Hand
Posts: 138
Java Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can you tell me what the details function does? If it is passing control to some servlet by modifying the "action" attribute of the form, for eg, forms[0].action = someUrl, then you can pass the value in the URL as a request parameter.


Read this value in details function and append it to the URL.
 
Sohaila Razali
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

my function supposed to execute a method in java class. whereby it needs to capture the i value from the jsp page so that I can extract data from database based on the selection.

as for this,
function details(value){
frm.pageAction.value = "details";
frm.submit();
}
<a href="#" onclick=details('<%=i%>')></a>

i tried the above code before bt i do not know how to pass the data to the java class. so yeah I'm stuck here I guess.
Is there anyway I can resolve this? Thnks.
 
Swastik Dey
Rancher
Posts: 1686
7
Android Eclipse IDE Java Java ME
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Sohaila Razali
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I think I got what you all mean already. Thank you so much for all the suggestions! :)

Regards,
haila
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!