Highlighted

Drop-down list with sublist

New Here ,
Aug 03, 2020

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.

Topics

PDF forms

Views

48

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Drop-down list with sublist

New Here ,
Aug 03, 2020

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.

Topics

PDF forms

Views

49

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Aug 03, 2020

Copy link to clipboard

Copied

Any error in the Javascript console?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Most Valuable Participant ,
Aug 03, 2020

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Participant ,
Aug 03, 2020

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 .

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Resources
One Stop Solution for Acrobat
Edit a PDF