Copy link to clipboard
Copied
There are two different dropdowns (named "dd1" and "dd2") with the same 13 selections ("a" through "m")
When "a" or "b" is selected, a hide field should to appear.
Example script for both dd1 and dd2:
if((event.value =="a") || (event.value =="b")) {
this.getField("Hide").display = display.visible;
} else {
this.getField("Hide").display = display.hidden;
}
This script works for both dropdown's, however, if the selection for "dd1" was NOT
"a" or "b", the hide field needs to stay hidden even if "a" or "b" is selected from "dd2".
Is there a way to add this condition to the validation script for "dd2" (i.e., reference "dd1" and it's selections)?
Any help would be appreciated!
Copy link to clipboard
Copied
Something like this:
var dd1Value = this.getField("dd1").value;
var dd2Value = event.value;
if ((dd1Value == "a" || dd1Value == "b") && (dd2Value == "a" || dd2Value == "b")) {
this.getField("Hide").display = display.visible;}
else {
this.getField("Hide").display = display.hidden;}
Copy link to clipboard
Copied
Check also the value of the other dropdown.
Copy link to clipboard
Copied
If implemented this way, the second script becomes redundant. It cannot influence the visibility of the "Hide" field unless dd1 is set to "a" or "b"—but in that case, the field is already made visible by the primary script tied to dd1. Therefore, the second script serves no functional purpose in this setup.
Copy link to clipboard
Copied
The example script shown above is to have the text field "Hide" visible when the either "a" or "b" is selected from the dropdown and hidden when any of the other options (e.g., "c") is selected. This portion works as is should. The problem I have is that if "a" or "b" is NOT selected in both dd1 and dd2, the "Hide" field needs to be hidden, even if "a" or "b" is selected from dd2. Is there a way to write in the validation code for dd2, that if "dd1" event.value does not equal "a" or "b" then the text field "Hide" should be hidden? I am not sure how to refer to a separate dropdown field (i.e., refer to "dd1" in the validation script for "dd2". I hope this explains what I am trying to do more clearly.
Copy link to clipboard
Copied
Something like this:
var dd1Value = this.getField("dd1").value;
var dd2Value = event.value;
if ((dd1Value == "a" || dd1Value == "b") && (dd2Value == "a" || dd2Value == "b")) {
this.getField("Hide").display = display.visible;}
else {
this.getField("Hide").display = display.hidden;}
Copy link to clipboard
Copied
That worked! Thank you so much for your time and expertise.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now