Get selected field(s)

Dec 13, 2017

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.

TOPICS
Acrobat SDK and JavaScript, Macintosh, Windows

Views

255

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Get selected field(s)

Dec 13, 2017

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.

TOPICS
Acrobat SDK and JavaScript, Macintosh, Windows

Views

256

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Dec 13, 2017 0
Dec 13, 2017

Copy link to clipboard

Copied

No, can't be done.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 13, 2017 1
Dec 13, 2017

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?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 13, 2017 0
Dec 13, 2017

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 13, 2017 0
Dec 13, 2017

Copy link to clipboard

Copied

Ok thanks. And just to confirm, there's no way to add to the "Field Properties" UI is there?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 13, 2017 0
Dec 13, 2017

Copy link to clipboard

Copied

Not with JS.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 13, 2017 0
Dec 13, 2017

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 13, 2017 0
Dec 14, 2017

Copy link to clipboard

Copied

Thanks for the reply. I would like to either:

  1. Be able to add an item to the context menu that shows up when you right click on a field when preparing the form so that I can bring up a dialog to edit metadata associated with the selected field.
  2. Be able to select a field, then click a custom button under add-on tools which would run JavaScript and ideally get a reference to the selected field so that when the metadata dialog comes up I already have the metadata for the selected field loaded rather than them having to always select the field they want to change the metadata for in the dialog each time.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 14, 2017 0
Dec 14, 2017

Copy link to clipboard

Copied

What field metadata are you referring too?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 14, 2017 0
Dec 14, 2017

Copy link to clipboard

Copied

I'm just storing arbitrary metadata for some of the form fields under document.info.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 14, 2017 0
Dec 14, 2017

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? 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 14, 2017 0
Dec 14, 2017

Copy link to clipboard

Copied

the "info" object contains document metadata, not field metadata.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 14, 2017 0
Dec 14, 2017

Copy link to clipboard

Copied

But you can do this as I pointed out earlier, you just can't detect which fields are selected.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 14, 2017 1
Dec 14, 2017

Copy link to clipboard

Copied

See this article:

Alerts, Popups, and Other Devices for Interacting with the User

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 14, 2017 1
Dec 14, 2017

Copy link to clipboard

Copied

Yep, ok, that's the route I was thinking I'd need to go.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 14, 2017 0
Dec 14, 2017

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?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 14, 2017 0
Dec 14, 2017

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 14, 2017 1
Dec 14, 2017

Copy link to clipboard

Copied

Ok, thanks for the help!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 14, 2017 0