Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting the clientId of an XPages button programmatically

Tags:

xpages

When I create a submit button on the form the following is generated in the HTML

XSP.attachEvent("view:_id1:_id2:_id38:_id55", 
    "view:_id1:_id2:_id38:button1", "onclick", null, true, 2);
});

"view:_id1:_id2:_id38:_id55" = the clientId of the eventHandler

"view:_id1:_id2:_id38:button1" = the button clientID (not at all confusing)

Much as I love the Portable Command Guide - I am unable to determine how I can programmatically get the eventHandler clientId.

I need the clientID to submit the form via ajax using the $$xspsubmitid field value

Can this be done through faces? and SSJS?

like image 764
MarkyRoden Avatar asked Apr 13 '12 19:04

MarkyRoden


2 Answers

Reading deeper into what you want to do, I think taking a look at this article I wrote sometime back will give you deeper understanding of what is going on. The ID you are attempting to get, the clientId, rather than the targetClientId, is the id of the event handler, which you can get by assigning an id to, for example:

<xp:eventHandler id="foo">

that will force the runtime to use the specified ID rather than an auto-generated one, allowing you to get a handle on it.

like image 167
Jeremy Hodge Avatar answered Jan 04 '23 12:01

Jeremy Hodge


getComponent("button1").getClientId(facesContext)
like image 33
Tim Tripcony Avatar answered Jan 04 '23 12:01

Tim Tripcony