xpages-onClick event in link of Repeat control

I have a Repeat control which repeats a Link control. Each link displays a title and points to a url. Works great.

Now I want to add some code in the onClick event for each link. It will set a session variable.

However, even tho I put code in the onClick event, it’s not showing up. Seems like this should be possible. Any ideas?

thanks

clem

Subject: Might be a problem in the execution order

Hi,

This might be a problem in the order in which the events are executed: if you click the link the URL is opened by the browser and there is no server interaction.

What I’d suggest: remove the URL from the link control and add a serverside redirect to the (SSJS) code that’s being executed. Use one of the context redirecTo methods (e.g. context.redirectToPage(“anXPage”) ) or use this:

var url = “http://www.disney.com”;

var extCont:javax.faces.context.ExternalContext = facesContext.getExternalContext();

extCont.redirect(url);

Mark

Subject: Need to use the repeat control

Hi Mark

thanks for the reply. The reason I’m using the repeat control is that the set of urls in my list are built dynamically. They are children pages. So a link to say the ‘customers’ page will generate one set of navigation links, but the ‘Industries’ link will generate a different set. And it actually is pretty cool the way it works. What I need to do next is tie the grandchild link to a grandchild page.

But I think you’re right, I should use SSJS. I can do this if I could push the grandchild’s url href property to into a session scope variable but I can’t figure out how to get a handle to the link control.

So the idea is that when I select a grandchild link, the url selected is pushed into a session scope variable, then I load the xpage. On load, it parses the link and will know what unid in the backend to point to. I thought I could do this in the onClick event of the url but that won’t work. So if I could just get the href property to the session variable, I could make it work.

thanks

clem

Subject: Found a solution…

It was easier than I thought. Since the link control has the specific document in context, I just pull out the index to that document and passed it to the xpage. It decides to display the content of the document that’s in context. It all just works. :slight_smile:

clem