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

Looking for assistance on Dropdown menu display items based on another field response.

New Here ,
Nov 03, 2022 Nov 03, 2022

I'm seeking assistance on how to get the dropdown menu item options to only be present for certain selection from another field.

 

Rebecca26950191xu05_2-1667504829447.png

 

 

If Seperation Type is Voluntary, then the Details menu shows these value from the Item List

Rebecca26950191xu05_1-1667504732436.png

 


If Seperation type is Involuntary, then the Details menu shows these Items

Rebecca26950191xu05_0-1667504720700.png

 

TOPICS
How to , JavaScript
314
Translate
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 ,
Nov 04, 2022 Nov 04, 2022
LATEST

Hi,

 

This has been answered before with different methods using Acrobat JavaScript in these forums.

 

If I understood correctly you need  the user to interact with the "SEPARATION TYPE" dropdown menu. And based on the selection  that the user selects another dependent dropdown menu will populate a specific list of items.

 

If you are new to Acrobat JavaScript you can try my example below, which employs a Custom Keystroke script.

 

In my opinion is the simplest method I could find (but it is worth noting that it is not as elegant as other more advanced scripts that I've seen around).

 

But anyway, I am executing the custom keystroke script from the "SEPARATION TYPE" dropdown menu:

 

 

 

if(event.willCommit) {

if(event.value =="VOLUNTARY") {

this.getField("Dropdown2").setItems(["<SELECT ONE>",
 
                                     "FAM-PERSONAL/FAMILY",

                                     "HEA-HEALTH/MEDICAL",

                                     "TRA-TRANSPORTATION ISSUES"

                                    ]);  


} else {


if(event.value =="INVOLUNTARY") {


this.getField("Dropdown2").setItems(["<SELECT ONE>",

                                     "ATT-ATTENDANCE",

                                     "IMP-IMPROPER W/GUEST",

                                     "FCE-FAILED EMP.CONDITIONS",

                                     "FAL-FALSIFICATION OF DOCS",

                                     "RLS-REV/SUP OF GAMING LICENSE"

                                    ])
 

  } else {


if(event.value =="<SELECT ONE>") {this.getField("Dropdown2").setItems(["<SELECT ONE>"])}


    }

  }

}

 

 

 

NOTE:

 

You make copy the script, go to the Format tab select "Custom Keystroke Script" and paste it in the JavaScript editor for that section.

 

Additionally, go to the "Options" tab and ensure that the tick box "Commit selected value immediately" is checked in both dropdown menu fields.

 

Translate
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