Two drop-down menus with condition.

Community Beginner ,
Feb 19, 2021 Feb 19, 2021

Copy link to clipboard

Copied

Hello. I am asking for help in solving this problem.

There are two drop down menus (DROP and DROP 2) and they already contain a working script in (Format->Custom->Custom Keystroke Script):

 

DROPDROP 2
AA
BB
CC
DD
EE
FF
GG
HH

 

How to make it so that when selecting

- A in the DROP drop-down menu in the DROP 2 drop-down menu, only B, C, D, H are visible

- B in the DROP drop-down menu in the DROP 2 drop-down menu, only B, D, E, G, H are visible

- C in the DROP drop-down menu in the DROP 2 drop-down menu, only A, B, D, E, G, H are visible

 

Thank you.

 

P.S. I want to say right away that I do not understand Java Script, I only adapt those scripts that I could find on the Internet. But I did not find anything similar with a popular explanation. Please note that these forms (DROP and DROP 2) already have a script.

 

 

TOPICS
JavaScript, PDF forms

Views

77

Likes

translate

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

correct answers 1 Correct Answer

Most Valuable Participant , Feb 19, 2021 Feb 19, 2021
The basic code for doing it (from the validation script of DROP) is this:   if (event.value=="A") this.getField("DROP 2").setItems(["B", "C", "D", "H"]);   Note that this will mean the "B" option will be selected in "DROP 2", as it's the default value (the first one in the list). If you want you can add a blank item before it, or something like that.

Likes

translate

Translate

Translate
Most Valuable Participant ,
Feb 19, 2021 Feb 19, 2021

Copy link to clipboard

Copied

The basic code for doing it (from the validation script of DROP) is this:

 

if (event.value=="A") this.getField("DROP 2").setItems(["B", "C", "D", "H"]);

 

Note that this will mean the "B" option will be selected in "DROP 2", as it's the default value (the first one in the list).

If you want you can add a blank item before it, or something like that.

Likes

translate

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 Beginner ,
Feb 19, 2021 Feb 19, 2021

Copy link to clipboard

Copied

Thank you so much. Everything worked out.Works great (does not conflict) with already used scripts.

 

True, I inserted your script into Format->Custom->Custom Keystroke Script.

 

Thank you again.

Likes

translate

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