I found this sample code on this site:
var aFruits = ["Fruits","Apples",["Oranges","navel","valencia"]]; var aVeggies = ["Vegetables","Beans","Corn"]; // Create an array to hold the top level menu entries var aTopItems = [aFruits, aVeggies]; // Place Additional entry at end of the Top Level Item Array var aBerries = ["Berries","Huckle","Goose"]; aTopItems.push(aBerries); var cRtn = app.popUpMenu.apply(app, aTopItems); if(cRtn != null) this.getField("Myfld").value = cRtn;
How do I get this to apply to a field?
I'm creating a form that will have multiple rows reactive to the selection of one field/button. I was planning to use the app.popUpMenu from a button, but all examples I'm finding so far show it triggering hyperlinks or documents. Can someone help me in getting this to populate a field? My fields are defined as follows:
Row1.Item Row1.Bonus Row1.Dmg Row1.Rng
Row2.
Row3.
I was planning to use:
var cRowName = event.target.name.split(".").shift();
But this I will try to hash out on my own first. I'm failing in hashing out this popup menu.
[b]The result would be oranges navel 12 fruit 3lbs.[/b]
var aVeggies = ["Vegetables","Beans","Corn"];
// Create an array to hold the top level menu entries
var aTopItems = [aFruits, aVeggies];
// Place Additional entry at end of the Top Level Item Array
var aBerries = ["Berries","Huckle","Goose"];
aTopItems.push(aBerries);
var cRtn = app.popUpMenu.apply(app, aTopItems);
console.show();
console.clear();
console.;println("You selected: " + cRtn);
if(cRtn != null)
this.getField("Myfld").value = cRtn;
If you use this code on a button field, then the "event.target" is the button field or the field trigging the action and the "event.target.name" is the name of the field.
George Kaiser