How To Populate Text Field When A Drop Down List Item From Another Field Is Selected?

Hello fellow Acrobat Users!

I am a photographer. When a new client signs up for a shoot, I manually create a word doc that outlines the package they are buying which outlines what's in the package (such as price, deliverables etc). Instead of manually creating a new word doc for every new client, I want to create a pdf that will allow me to streamline the process by automatically populating what I would otherwise have to type manually. I have some experience with Acrobat Pro XI. I have created basic forms.

Here's my question:

How do I go about creating a text field that content will be populated inside of it based on the selection made from a drop down list of a different field?

For example, I will have a drop down list field called "Packages" that will have the following items:

Package A
Package B
Package C

If I select "Package A" from the Packages drop down list, I want the selection of "Package A" to populate content in the text field called "packageContents". The content to be populated in the text field will outline the deliverables of "Package A" such as:

3 Hours of Photography
Family Portrait Print
(5) 8x10 Prints
CD of all Images Taken

How do I go about accomplishing this? Thanks in advance for you help follow Acrobat Users!

Andre Gant

2 Answers

Voted Best Answer

You can use something like this as the custom calculation script of "packageContents":

var selectedPackage = this.getField("Packages").value;
if (selectedPackage=="Package A") event.value = "3 Hours of Photography\nFamily Portrait Print\n(5) 8x10 Prints\nCD of all Images Taken";
else if (selectedPackage=="Package B") event.value = "Some text for package B";
else if (selectedPackage=="Package C") event.value = "Some text for package C"; // etc.
else event.value = "";

Make sure you set the drop-down's option to commit the selected value immediately to have the text field's value update as soon as a selection is made.


Visit my custom-made PDF scripts website:
Contact me personally:

By Gilad D (try67)   

Read this article:

And this one:

Thom Parker
The source for PDF Scripting Info
All About PDF Stamps in Acrobat and Paperless Workflows - THE BOOK !!

The Acrobat JavaScript Reference, Use it Early and Often

The most important JavaScript Development tool in Acrobat
The Console Window (Video tutorial)
The Console Window(article)

Having trouble, Why Doesn't my Script Work

Thom Parker   

Please specify a reason: