Copy link to clipboard
Copied
Hi, I am trying to make a drop-down list with a sublist where I would need to select a specific country and as a result, to show in the drop-down box is the country code of that specific country. I have tried this code
var rtn=app.popUpMenu
(
["(+3)"],
["(+6)"],
["(+4)"]
)
if(rtn){this.getField("Country").value=rtn}
note that the following selection I've put in item lists is:
Afghanistan
Albania
Algeria
however, after the selection of the sublist, it just shows the name of the country but not the following numbers in the sublist.
Copy link to clipboard
Copied
Any error in the Javascript console?
Copy link to clipboard
Copied
Your code is incorrect and will not display the pop-up at all. Also, what you described has nothing to do with the code. Please post the full code you're using. And I would recommend using the popUpMenuEx method, not popUpMenu, as it gives you much better control over how the items are displayed and organized in the list.
Copy link to clipboard
Copied
1. Remove square brackets from items ["+3"] --> "+3"...etc you don't need them in single line popup menu.
2. Add semicolon at the end of your list ..."+4") --> ...+"4"); and at the end of your code
...value = rtn}--> ...value = rtn;} that should make your code working.
For adding sublist check here .