Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Would like to execute custom js when the button is clicked.
Is this possible currently?
Comments
Comment #1
BassistJimmyJam CreditAttribution: BassistJimmyJam commentedThis is not currently possible. The displayed field simply uses the click event and returns false to prevent the default event from firing. Since the field returns false you will not be able to reliably bind to the click event yourself. I will add this to the list of requested features.
Comment #2
BassistJimmyJam CreditAttribution: BassistJimmyJam commentedDrupal 7 supports custom ajax commands that could be used to accomplish this. You would need to create a custom rule to add the action to the response or wait for #1327094: Invoke hook on button field click and add it in a custom module. As a result, I will not be adding this feature to either the 6.x or the 7.x branch.