Pages

Wednesday, March 3, 2010

Getting an xpage component's id programatically when the same is clicked

Create an XPage.

Drag and Drop a button Control on to it and give the button a name and a label

Now on the events tab of the button, in the onclick event, select client side and type in the following code

var currId = thisEvent.target.id;
alert(currId);

Now and preview your XPage and click the button.

The result would be an alert box with the id of the button control that you have mentioned in the XPage. Again it will not be exactly the same but will be along with a pattern generated by the XPage and the same will be consistent.

2 comments:

  1. thanks this was just what i had been looking for

    ReplyDelete
  2. It really took me a lot of time to find this. Happy that it was of use to you

    ReplyDelete