Copy link to clipboard
Copied
When in "Prepare Form" mode in Adobe Acrobat Pro DC, is there a way to get the selected field name(s) via JavaScript? I would like the user to be able to select a field (or multiple fields), and then click a custom button under "Add-ons" so that I can bring up my own custom dialog. I don't want to write a C++ plugin. Thanks in advance.
No, can't be done.
Copy link to clipboard
Copied
When in "Prepare Form" mode in Adobe Acrobat Pro DC, is there a way to get the selected field name(s) via JavaScript? I would like the user to be able to select a field (or multiple fields), and then click a custom button under "Add-ons" so that I can bring up my own custom dialog. I don't want to write a C++ plugin. Thanks in advance.
No, can't be done.
Copy link to clipboard
Copied
No, can't be done.
Copy link to clipboard
Copied
Thanks for the reply. Is there any work around for this? Or do I need to create a generic dialog that gives them a field selection list where once they select a field I programmatically modify some of the properties I'm allowing them to change? In this case metadata...
Also, can this be done in C++? Also wondering if I could add a context menu item via C++ and have it call a JavaScript function passing the field name in context or is there no way to bridge the two programming languages?
Copy link to clipboard
Copied
If that's what you want to do then yes, you would need to display a list of the field names and have the user select from it (or have them enter the field's name into a text field, or something like that).
I don't know about whether it can be done using C++. Try the Acrobat SDK forum. I doubt it, though.
Copy link to clipboard
Copied
Ok thanks. And just to confirm, there's no way to add to the "Field Properties" UI is there?
Copy link to clipboard
Copied
Not with JS.
Copy link to clipboard
Copied
You cannot modify anything in the Prepare Form tools from the standard API/SDK (JS or C++). Unless of course you are working with MS Windows and you know how to subclass windows and hijack messages, then of course, you can create a plug-in that gets in there. But it won't do you much good.
What exactly do you want to do? There is probably another way.
Copy link to clipboard
Copied
Thanks for the reply. I would like to either:
Copy link to clipboard
Copied
What field metadata are you referring too?
Copy link to clipboard
Copied
I'm just storing arbitrary metadata for some of the form fields under document.info.
Copy link to clipboard
Copied
You can create toolbar buttons with either a plug-in or JavaScript, but neither has the ability to detect a selected field. However, you could provide the user with a list of fields that are visible on the page.And then set you metadata from there.
But what metadata are you talking about?
Copy link to clipboard
Copied
the "info" object contains document metadata, not field metadata.
Copy link to clipboard
Copied
But you can do this as I pointed out earlier, you just can't detect which fields are selected.
Copy link to clipboard
Copied
See this article:
Alerts, Popups, and Other Devices for Interacting with the User
Copy link to clipboard
Copied
Yep, ok, that's the route I was thinking I'd need to go.
Copy link to clipboard
Copied
Right, it's document metadata which I'm using to store metadata about certain fields since I'm not aware of any other place to store metadata associated with fields?
Copy link to clipboard
Copied
If you look down the list of field properties you'll find only a single one that can contain arbitrary text and not screw up the field, "userName" . This is the popup text displayed when the mouse hovers over the field. So you're correct.
Copy link to clipboard
Copied
Ok, thanks for the help!