Skip to main content
Known Participant
February 19, 2021
Answered

Two drop-down menus with condition.

  • February 19, 2021
  • 1 reply
  • 854 views

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.

 

 

This topic has been closed for replies.
Correct answer try67

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.

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
February 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.

Known Participant
February 19, 2021

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.