AnsweredAssumed Answered

How to capture the name of the button when clicked or add javascript to button?

Question asked by Mike Solomon on Jul 15, 2014
Latest reply on Dec 14, 2016 by Dan Ross
In record.js I'm doing a database lookup and creating buttons with the data returned

The data returned depends on the status of the record

It could be one or many buttons

I set the event to be event: "button:set_status:click", for all the buttons created and set the name of the button to be the status I'm changing the record too

Clicking on the button calls a function set_status

The problem I have is that I need to know which button was clicked to know what action todo

How can I capture this?

The button html is <a class="rowaction" href="javascript:void(0);" data-event="button:set_status:click" name="submitted" track="click:submitted">
Submit</a> and "submitted" is what I need to capture when the button is clicked

I could of course give each button a unique event and create a seperate function for each but that would totally defeat the object of what I'm trying to acheive

Any help would be much appreciated


Outcomes