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

Menu button won't fill more than one field

Duniagdra
Registered: Sep 24 2008
Posts: 140
Answered

Here is the code for my menu button:

var aFruits = ["Fruits",["Apples","Macintosh","Red_Delicious","Green"],["Oranges","navel","valencia"],["Berries","Huckle","Goose"]];
var aVeggies = ["Vegetables",["Beans","Kidney","Black_eyed"],["Corn","Sweet","Stock"]];
 
// Create an array to hold the top level menu entries
var aTopItems = [aFruits, aVeggies, aArmor];
 
var cRtn = app.popUpMenu.apply(app,aTopItems);
 
console.show();
console.clear();
console.println("You selected: " + cRtn);
 
if(cRtn != null)
   this.getField("Text4").value = cRtn;

For testing I've made the following array:
var oProduct = {
                       Macintosh: [3,"Fruit","1lbs."],
                       Red_Delishious: [7,"Sweet","1/2lbs."],
};

The button will put Macintosh in field "Text4" and works great. For the example, I then have fields "Text5", "Text6", and "Text7" that I'm trying to display 3, Fruit, and 1lbs respectively once Macintosh becomes the active value. Is there a clean and simple way to do this?

Thanks in advance for any help that can be offered,
Jim

Thanks in advance for any help provided,
Jim
The All Time Professional Amateur Hack

My Product Information:
Acrobat Pro 8.0, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You've done really well so far!! All you have to do now is use the selected value to acquire the other values from "oProduct".

For example:
if(cRtn != null){this.getField("Text4").value = cRtn;this.getField("Text5").value = oProduct[cRtn][0];this.getField("Text6").value = oProduct[cRtn][1];this.getField("Text7").value = oProduct[cRtn][2];}

There are tutorials and examples that show different methods for doing exactly this kind of thing at www.pdfscripting.com

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/]http://www.adobe.com/devnet/acrobat/[/url]

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

Duniagdra
Registered: Sep 24 2008
Posts: 140
I'm not sure what happened, but I just found my thanks in another thread titled "what exactly is mysql???"

Anyhow...

Thanks Thomp,

Your help has given me another great step forward.

Thanks in advance for any help provided,
Jim
The All Time Professional Amateur Hack