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

Dependent Dropdowns Dependent Cases

New Here ,
Jan 30, 2025 Jan 30, 2025

Copy link to clipboard

Copied

To Whom it May Concern,

 

I am trying to get some assistance with both, mulitple dropdowns list working together with mulitple cases conditions within those same dropdowns list , but I am unable to find the correct solution.

 

I have three dropdowns fields. 

Dropdown 1,  Dropdown 2, and Dropdown 3.

 

Dropdown 1 list is independent of any other dropdown fields, or text boxes.  Dropdown 1 list contain two digit values, ("01", "02", "03", "04",  etc..)

 

Dropdown 2 list is supposed to be dependent on the result of what was picked from Dropdown 1 list. 

Dropdown 2 list also contains a list of two digit values, ("01", "02", "03", "04",  etc..) (*Please note that the individual items in Dropdown 1 and Dropdown 2 look the same, but in reality represent different things).

 

Dropdown 3 list is supposed to be dependent on the result that was picked from Dropdown 1 list AND the results of Dropdown 2 pick.

 

Dropdown 3, contains a list of items, ("A", "B", "C", etc..)

 

All dropdown three fields have the "Commit selected value immediately" option selected.

 

In addition to assigning the list from Dropdown 1 to Dropdown 2, and producing a list based on the pick of DropDown 1 AND Dropdown 2 to produce Dropdown 3 list.  I am trying to get this Switch Case function to work properly.  

 

Some of my effort toward achieving my goal has resulted in postive results, if I am only using what I call one case conditon.  However, if I use two or more case condtions trying to employ this "Fall Through technique" that I read about, I am getting hit or miss results.

 

Here is my code that I place in Dropdown 1 "Custom Keystroke Script" editor:

 

if (!event.willCommit){
var a = this.getField("Dropdown2");
var b = this.getField("Dropdown3");
a.clearItems();
b.clearItems();


switch (event.change){

case "01":
a.setItems(["Select ","01", "02", "03", "04", "11"]);
break;

case "02":
a.setItems(["Select ","01", "02", "03", "06",]);
break;

}

}

 

 

The code that I put Dropdown 2 "Custom Keystroke Script" editor looks like this:

 

if (!event.willCommit){
var b = this.getField("dropdown1")
var c = this.getField("dropdown2")
var d = this.getField("dropdown3");

c.clearItems();
d.clearItems();

 

switch (event.change){

case "01":
case "01":
d.setItems(["Preparers1"])
break;

 

case "01":
case "02":
d.setItems(["Preparers2"])
break;

 

case "01":
case "03":
d.setItems(["Preparers3"])
break;

 

case "01":
case "04":
d.setItems(["Preparers4"])
break;

 

case "01":
case "11":
d.setItems(["Preparers5"])
break;

 

case "02":
case "01":
d.setItems(["Preparers6"]);
break;

 

case "02":
case "02":
d.setItems(["Preparers7" ]);

break;

 

case "02":
case "03":
d.setItems(["Preparers8",]);

break;

 

case "02":
case "06":
d.setItems(["Preparers9"]);
break;

}

}

 

 

The results after picking a item from dropdown 1 and dropdown 2  list don't give me what I should be seeing in dropdown 3 list.  Either I am getting nothing showing up at all in Dropdown 3, or I get the wrong output.

 

For example, I might pick "02" from Dropdown 1, and "04" from Dropdown 2, and I may get nothing in dropdown 3, but sometimes if change Dropdown2 back to something else, I might get something, but its typically wrong.  It almost like Javascript is picking its time to run the code, and when it does choices to randomaly assigned values.

 

I was told to use switch case option as oppose to using an large if statements.  But neither approaches are working for me.

 

I also consider trying to combined the results from Dropdown 1 and Dropdown 2 into a single output to run the cases on one condition case as opposed to two cases conditions.  But I don't know how to combined outputs from both dropdowns.  I know I am close to a solution, but I can't find that last little bit to get me over the hump.

 

Any solutions in any direction would be appreciation. Thank you

Views

180

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
1 ACCEPTED SOLUTION
Community Expert ,
Jan 31, 2025 Jan 31, 2025

Copy link to clipboard

Copied

The logic of your cases is flawed. If you have one case for "01" you can't have another for it later on, as it would never be reached. Can you explain in words what you're to achieve, exactly?

View solution in original post

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 ,
Jan 30, 2025 Jan 30, 2025

Copy link to clipboard

Copied

is this an acrobat question?

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
New Here ,
Jan 30, 2025 Jan 30, 2025

Copy link to clipboard

Copied

Yes.

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 ,
Jan 31, 2025 Jan 31, 2025

Copy link to clipboard

Copied

in the future, to find the best place to post your message, use the list here, https://community.adobe.com/

p.s. i don't think the adobe website, and forums in particular, are easy to navigate, so don't spend a lot of time searching that forum list. do your best and we'll move the post (like this one has already been moved) if it helps you get responses.



<"moved from using the community">

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 ,
Jan 31, 2025 Jan 31, 2025

Copy link to clipboard

Copied

The logic of your cases is flawed. If you have one case for "01" you can't have another for it later on, as it would never be reached. Can you explain in words what you're to achieve, exactly?

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
New Here ,
Jan 31, 2025 Jan 31, 2025

Copy link to clipboard

Copied

Try67,

 

Thank you reponse, however, I am not sure I understand fully your explaination.

 

So, if I have three dropdown fields.  

in which Dropdown2 list depends on Dropdown1's pick, and Dropdown3 list depends on Dropdown1 AND Dropdown2 picks.  AND Dropdown1 list of choices share similar naming convention to Dropdown2 list even though they represent different entities.

 

Are you saying that I can't have any of Dropdown2 choices match any of the choices of Dropdown1 if I wish to use a switch case methodology? 

 

For example:

if 

Dropdown1 (D1) has the following list:

"01"

"02"

"03"

 

Dropdown2 (D2) has the following list

"01"

"02"

"03"

 

Dropdown3 (D3) has the following list:

"A"

"B"

"C"

 

and I go to pick from any of the following combination:

Dropdown1, "01", and from Dropdown2, "01", and Dropdown3, "A" - (Are you saying this is invalid, D1 and D2 matches?)

Dropdown1, "01", and from Dropdown2, "01", and Dropdown3, "B"- (Are you saying this is invalid, D1 and D2 matches?)

Dropdown1, "01", and from Dropdown2, "01", and Dropdown3, "C"- (Are you saying this is invalid, D1 and D2 matches?)

Dropdown1, "01", and from Dropdown2, "02", and Dropdown3, "A" 

Dropdown1, "01", and from Dropdown2, "02", and Dropdown3, "B"

Dropdown1, "01", and from Dropdown2, "02", and Dropdown3, "C"

Dropdown1, "01", and from Dropdown2, "03", and Dropdown3, "A"

Dropdown1, "01", and from Dropdown2, "03", and Dropdown3, "B"

Dropdown1, "01", and from Dropdown2, "03", and Dropdown3, "C"

 

Dropdown1, "02", and from Dropdown2, "01", and Dropdown3, "A"

Dropdown1, "02", and from Dropdown2, "01", and Dropdown3, "B"

Dropdown1, "02", and from Dropdown2, "01", and Dropdown3, "C"

Dropdown1, "02", and from Dropdown2, "02", and Dropdown3, "A"- (Are you saying this is invalid, D1 and D2 matches?)

Dropdown1, "02", and from Dropdown2, "02", and Dropdown3, "B"- (Are you saying this is invalid, D1 and D2 matches?)

Dropdown1, "02", and from Dropdown2, "02", and Dropdown3, "C"- (Are you saying this is invalid, D1 and D2 matches?)

Dropdown1, "02", and from Dropdown2, "03", and Dropdown3, "A"

Dropdown1, "02", and from Dropdown2, "03", and Dropdown3, "B"

Dropdown1, "02", and from Dropdown2, "03", and Dropdown3, "C"

 

Dropdown1, "03", and from Dropdown2, "01", and Dropdown3, "A"

Dropdown1, "03", and from Dropdown2, "01", and Dropdown3, "B"

Dropdown1, "03", and from Dropdown2, "01", and Dropdown3, "C"

Dropdown1, "03", and from Dropdown2, "02", and Dropdown3, "A"

Dropdown1, "03", and from Dropdown2, "02", and Dropdown3, "B"

Dropdown1, "03", and from Dropdown2, "02", and Dropdown3, "C"

Dropdown1, "03", and from Dropdown2, "03", and Dropdown3, "A"- (Are you saying this is invalid, D1 and D2 matches?)

Dropdown1, "03", and from Dropdown2, "03", and Dropdown3, "B"- (Are you saying this is invalid, D1 and D2 matches?)

Dropdown1, "03", and from Dropdown2, "03", and Dropdown3, "C"- (Are you saying this is invalid, D1 and D2 matches?)

 

Essentially, using this example, I need to be able to pick from Dropdown1 choice using this two digit veribages, which just so happens to match the veribage choices of dropdown 2 list. (meaning sometimes they'll match and sometime that won't) and allow me to get the 27 different cominbation of results. But also remembering that Dropdown2 list depends on Dropdown1 pick  AND Dropdown3 list depends on both Dropdown1 And Dropdown2 pick.

 

Does this additional information help with what I am trying to do?

 

Thank you

 

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 ,
Jan 31, 2025 Jan 31, 2025

Copy link to clipboard

Copied

You must check the values of D1 and D2.

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
New Here ,
Jan 31, 2025 Jan 31, 2025

Copy link to clipboard

Copied

Bernd,

 

Thank you for your response.  However, I am not tracking on your suggestion.  What do you mean check the value of D1 and D2?

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 ,
Jan 31, 2025 Jan 31, 2025

Copy link to clipboard

Copied

I mean the dropdowns.

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 ,
Jan 31, 2025 Jan 31, 2025

Copy link to clipboard

Copied

Use something like this, then:

 

var v1 = this.getField("Dropdown1").valueAsString;
var v2 = this.getField("Dropdown2").valueAsString;
var v3 = this.getField("Dropdown3").valueAsString;

if (v1=="01" && v2=="01" && v3=="A") event.value = "Are you saying this is invalid, D1 and D2 matches?";
else if (v1=="01" && v2=="01" && v3=="B") event.value = "Are you saying this is invalid, D1 and D2 matches?";

// etc.

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
New Here ,
Jan 31, 2025 Jan 31, 2025

Copy link to clipboard

Copied

Try67,

 

Thank you as well for your suggestion.  

 

However if I read this suggestion correctly, this would imply that I have three independent dropdowns as opposed to dependent dropdowns.  Meaning I would pick an option from dropdown list 1.  I would then pick from dropdown list 2.  And finally I would pick from dropdown list 3. 

 

Once I had done all that, I would have three options to essentially run this if statement against to see if it matches, and if it does, assign to some other another field.

 

And even if I took the third conditon off, and ran it with two conditions I still don't see how this works.

 

Again, I need to be able to go to dropdown1 field,  pick from one of the options availabe,  By doing so, this would assign a new list of options that look similar to dropdown1 field, to dropdown2 field.  Then after having picked from dropdown1 list I would go into dropdown2 list, thereby picking from that list.

Once I've done that, I want the output that came from my pick of dropdown1 and dropdown2 to produce a sepearate list, for dropdown3 field.  Then after that list is produe, I would go into dropdown3 field, and pick the final choice. 

 

Dropdown2 dependence on the choice that comes from Dropdown1, and Dropdown3 depends on Dropdown1 AND Dropdown2 choices.

 

However, with that said, I am not without error, if somehow I misunderstood your suggestion, please feel free to elaborate more on how and where you would see this working as you are thinking it might. 

 

I hope this continue help.

 

Thank you,

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 ,
Feb 01, 2025 Feb 01, 2025

Copy link to clipboard

Copied

The two things are unrelated, really. You can use a script to create your dependent dropdowns, and another to calculate the value based on those selections.

I've actually created a (paid-for) tool that could help you do the former. You can find it here:

https://www.try67.com/tool/acrobat-create-dependent-dropdowns

 

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 ,
Feb 01, 2025 Feb 01, 2025

Copy link to clipboard

Copied

LATEST

Actually, if you have three dependent drop-downs, this one might be more suited:

https://www.try67.com/tool/acrobat-create-cascading-dropdowns

 

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