Auto-Filling a Drop down List with a Drop down List

I have an acrobat form with 2 combo box drop down fields. I would like the first combo box choice to dictate the list in the second combo box. Combo box 1 is regions (Atlantic, Pacific, etc.) and combo box 2 needs to change based on the selection in combo box 1 to include locations only within that region.

I found a tutorial with a PDF example here:

http://acrobatusers.com/tutorials/pro...

However, this is a little more complicated than I need and I can't seem to edit down so that it works with my 2 box scenario.

Can anyone help me with this?


Liz Broes


4 Answers

Voted Best Answer

In that example there is a document level script that defines an object containing the info needed to fill the list. Basically it associates each selection from the first list with a list of entries for the second list.

This is all you need. Like this

var oSelListItems = {"aa":[1,2,3,4], "bb":[5,6], "cc":[7,8,9]};

The entries in the first list are "aa", "bb", and "cc". Each entry in the oSelListItems object is an array of items that will become the entries in the second list. I chose numbers for convenience, but they could easily be arrays of text.

The article shows how to use these arrays of values to populate the list entries.

Thom Parker
The source for PDF Scripting Info pdfscripting.com

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


By Thom Parker   

Thank you!

This works perfectly.


Liz Broes   

Hi there,

I have exactly the same issue, but dont know where to put my array in.

Iam using acrobat Pro.

What do i have to put in doplist 1, any actions and java script functions?

Do i put that list into droplist2 or only onto the documents script page?

How to geht that together?

I was reading the internet a long time, now iam very confused, even with tutorials for adobe lc.

Can anyone help me please?

sh


Sabine Hunglinger   

If the list tutorial and example file availible here on this site did not help. Then you can find a full set of tutorials and example files here:
http://www.pdfscripting.com/public/pr...

However, I suspect that the real issue is that you do not have a good understanding of how Acrobat and PDF operate. I think you would benifit from this article. In fact you should read it first.
http://acrobatusers.com/tutorials/so-...

And watch some of these videos:
http://www.pdfscripting.com/public/Fr...


Thom Parker   


Please specify a reason: