PDA

View Full Version : Links to the detail of an object



TerpInMD
Feb 24th, 2007, 09:34 AM
This should be easy....

I have a select box on a page. After it is changed I get another list of objects based on the selection on the select box. What I want to do is display a list of the objects in links so that when one is clicked the detail for that object is retrieved and displayed at the bottom of the page.

What I did was put a simple javascript function in each <a href> control. When its selected a hidden text box is populated, the form submitted, and the object detail retrieved. The issue is that the command object is reset because the page is being loaded again via the <a href> tag.

Everything works well if I just use two select box's but I dont want to do that. Here is the code that is not quite working (hardcoded to ID 15):


<c:forEach items="${command.articles}" var="var">
<a href="" onChange="setObjId('15')"><c:out value="${var.title}"/></a>
</c:forEach>

How can I change this so that a list like the following is generated and each one will retrieve the detail of the object w/o loading the page and resetting the form backing object again?

[clicking takes user to the detail]
Object 1
Object 2
Object 3

Thanks!

manifoldronin
Feb 24th, 2007, 10:29 AM
Try href="javascript:nop();"

jonnio
Feb 24th, 2007, 04:51 PM
or better yet href="#"

TerpInMD
Feb 24th, 2007, 07:14 PM
Each worked like a figgen' charm....thanks gentlemen!