• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Drop-down list with sublist

New Here ,
Aug 03, 2020 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

413

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
community guidelines
Community Expert ,
Aug 03, 2020 Aug 03, 2020

Copy link to clipboard

Copied

Any error in the Javascript console?

Votes

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
community guidelines
Community Expert ,
Aug 03, 2020 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.

Votes

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
community guidelines
Community Expert ,
Aug 03, 2020 Aug 03, 2020

Copy link to clipboard

Copied

LATEST

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 .

Votes

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
community guidelines