Tuesday, April 25, 2017

Acrobat -- Populate Fields From Dropdown




Direct purchase using PayPal ($40 only per license)!

Update (25/04/2017): Since many forms are now used on mobile devices I've updated this tool so that it will produce files that work on an iPad, using Readdle's PDF Expert app, which currently offers the best support for scripts on that platform.

This tool allows you to set-up one of the most commonly requested features in PDF forms, a drop-down field that populates other fields with data when a selection is made it in.

It makes the entire process very easy and simple to do. All you have to have are the PDF form with the form fields, and the data organized in a spreadsheet with the field-names in the first row. That's it!

And it's even possible to use it multiple times in the same file, using different data files, without any conflicts between the different fields...

For example, let's say we have all of this data in an Excel spreadsheet that we want to import into our PDF:
The original data file (click to enlarge)
 We just need to save it as a tab-delimited text file (which is one of the built-in options in the Excel Save As dialog).
We then open our PDF file (notice the names of the form fields match those in the header row of the Excel file), and click the button that tool adds to Acrobat:


Now we select the input text file we created before, and then specify the "main" drop-down, the one the will populate the other fields when its value is changed:

That's it! We can now see that the drop-down list is populated with all of the names from the "Name" column in our original data file:


And when we make a selection in the drop-down, the other fields are immediately updated with the relevant data from that row:



For more information about this tool, you can contact me directly.

13 comments:

Unknown said...

Have downloaded the Populate Fields from Dropdown add on and I cannot seem to get it to work.

I have saved a Tab delimited file of my excel spreadsheet which his two columns that I want to link to my pdf.

I have created a PDF file with the two fields (named them the same as the header field in excel). When I choose my file to link to I dont get any options to select the main combo- or listbox field.

Please help!!

I'm using Adobe Acrobat Pro DC

TDS said...

I understand that this will work for multiple fields, but what if I want to populate a single field based on what is typed into the field? For example, if the field asks the user to provide a place of service, i'd like the autofill based on what the user types in. If the options for service are only Home, School, Work, we want the Home option to auto-fill as soon as H is typed. is this possible? Thanks!

Gilad D. (try67) said...

@TDS
If you have a drop-down menu with these options it will work like that by itself. There's no need to use a script for that.

Unknown said...

Will the script work with LiveCycle Designer?

Gilad D. (try67) said...

@George Wells
I'm afraid not, only with Acrobat forms.

Unknown said...

I need to do something much like this, but I need to populate a field based on selections made in two dropdowns. For example, when a course prefix is selected in field 1 and the course number is selected in field 2, I want field 3 to be filled in with the proper name for the course designated by the selected prefix and number. Can this script be modified to do that (well, probably not by me, but by someone here that knows JS much better than I do)?

Gilad D. (try67) said...

@Mark Singer

Sure, that's possible. Contact me privately (try6767@gmail.com) to discuss it further, please.

(Sorry about the delay in replying. The comment was stuck in a hidden moderation queue.)

Unknown said...

Hi there - I just emailed you hoping you can answer my question - will this work with multiple dropdowns on the same sheet?

Gilad D. (try67) said...

I've replied by email.

Unknown said...

Hi there - will this work with multiple dropdowns on the same sheet?

Gilad D. (try67) said...

Yes, it will.

Unknown said...

Hello, I am having some difficulty getting this script to work, after setting it up the dropdown fails to populate and the debugger provides this error:


TypeError: Invalid argument type.
Doc.getDataObjectContents:60:App PopulateFieldsFromDropdown2:Exec
===> Parameter cName.
TypeError: Invalid argument type.

Like your sample case, the first column and dropdown are both labelled "Name."

Thank you.

Gilad D. (try67) said...

@Unknown
Please contact me via email (try6767 at gmail.com) and I'll help you solve this issue.