These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

popUpMenu question

JORO-David
Registered: Apr 14 2009
Posts: 25

I used Thom Parker's popup tutorial to create a functioning three-level popup menu, using the app.popUpMen() function.

For mine, here is the breakdown of the three levels: Continent (6 choices) --> Country (5 choices for each continent) --> City (10 choices for each country).

The tutorial shows how to capture the third-level input in a text box (in my example, the city).

My question is whether or not you are also able to capture the first-level (continent) and second-level (country) selections into text boxes and, if so, how to do it.

My ideal output would have 3 auto-populated textboxes:
ContinentBox=continent
CountryBox=country
CityBox=city (this is the only one the tutorial shows how to capture)

Thanks very much!!

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
There are two ways you can capture the full path information. The simplest is to build a reverse lookup table. Something like this:
var bRevLookup = {"SpringField":{continent:"North America", country:"USA"},"Mumbia":{continent:"Asia", country:"India"},"Rome":{continent:"Europe", country:"Italy"}};

Then use the output from the popup menu to find the continent and country from the table. This methodology runs into problems when two cities in different places have the same names.

The other methodology is to use the "popupMenuEx()" function which provides an explicit return value. Then you build the menu with the continent and country info built into the return value. Like this:
app.popUpMenuEx({cName:"Rome",cReturn:"Europe:Italy:Rome"});
Of course this example doesn't inlcude the hierachy, just one menu item.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script