How to perform an action when a form field is clicked?

54 views
Skip to first unread message

Matt Parizeau

unread,
Apr 13, 2018, 3:52:43 PM4/13/18
to pdfnet-w...@googlegroups.com
Q:

When a form field is clicked I would like to show a popover for the user to enter more information. How can I get an event when a field is clicked?

A:

You can extend the createInnerElement function for the types of widget annotations that you want click events for, and add the event to the DOM element. For example here is the code for text widgets, that you can put into your config.js file for example:

var createInnerElement = Annotations.TextWidgetAnnotation.prototype.createInnerElement;
Annotations.TextWidgetAnnotation.prototype.createInnerElement = function() {
 
var ele = createInnerElement.apply(this, arguments);
  ele
.on('click', function() {
    alert
('field clicked');
 
});

 
return ele;
};

Reply all
Reply to author
Forward
0 new messages