cancel
Showing results for 
Search instead for 
Did you mean: 

How to get dynamic id of component in share page ?

g_rathod
Star Contributor
Star Contributor
Hi Friend,

I want to get id from the share page (e.g share workflow page one of the button id which is out of box not custom)
Now I want to do some action based on that button click in workflow. So I want to define that id in my client side js.

So how can I get id in that js file?  as of now I do firebug and copy whole component id, but this is not proper way. Please suggest.
4 REPLIES 4

mitpatoliya
Star Collaborator
Star Collaborator
ID of all controls are prefixed with the Object id i.e. using "this".
If you want to see all associated events for particular control you could look in to client side javascript which is associated with particular component.

You will have to extend the component which you want to customize and then you can override all controls and methods within that.

Thanks Mittal,

But as we are doing changes in some workflow files, which are not design or develop by us. May be oob.
I am not able to find out its ftl that represent its button or combo. and in client side js I want to perform some action based on that button click.
so need id of that button.

As of now I am giving like below :

Dom.get("page_x002e_data-form_x002e_task-edit_x0023_default_prop_gemje_sendBackReason") 
but this is not good way.

I have observed few js having structure like this :
Dom.get(this.id + "-submit-button")

this.id I can provide but how do I identify suffix? In this case its -submit-button

Anyone can able to help me on this?

I do not know id of the component, its out of box not customized form. Now on workflow form I need a button action, so based on its ID I want to perform some action.
Please let me know how do I define it dynamically?

e.g.
In most of case, let say I have input box having id ="abcd"
then in js I will access mostly like
 Dom.get(this.id + "-abcd"); 

So if I use out of box component how do I get id of that component and can define such dynamically?
instead getting from firebug like  "page_x002e_data-form_x002e_task-edit_x0023_default_prop_gemje_sendBackReason"

hope you get it

hardik1512
Star Contributor
Star Contributor
Hello Ghanshyam,

For workflow, you can override activiti-transitions.js file.  This file contains onClick method which is called when any workflow buttons are clicked. Here there are two parameters out of which one is p_obj. You can use p_obj as below to know which button is clicked.

var buttonId = p_obj.get("id");
var transitionId = buttonId.substring(this.id.length+1);
if(transitionId == "Approve")
{
}
else if(transitionId == "Reject")
{
}

Hope this helps.