You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support a mouse-up JavaScript action on form fields (onClick option) #1792
Following the invitation in `docs/forms.md`'s Advanced Form Field Use section: "If an option is not supported, open an issue on Github and it will be considered for addition to the API."
The gap
There's no supported way to attach a mouse-up JavaScript action to a form field — most usefully, a push button that runs custom logic when clicked. The only code path that ever reaches `AA` is `mapFormat()`, and only together with a `format` option, which is meant for keystroke/format validation, not arbitrary actions. Any other use of `AA` is silently dropped with no error.
This came up building an interactive PDF with clickable push buttons that toggle state via a mouse-up action.
Proposed addition
An `onClick` option, accepted by all form annotation methods, mapping to the field's `AA.U` mouse-up action — accepting either a plain string or a function (stringified into the action, called with Acrobat's own `app`/`getField`/`display`/`event` as arguments and `this` bound to the Document).
I have a working implementation with tests, docs, and a small opt-in TypeScript types file for the handful of Acrobat globals the option's function form needs — see #1790.
Activity