Copy link to clipboard
Copied
Hi all, I'm trying to create a tournament pickems bracket in Adobe Acrobat Pro DC, with each of the dropdown lists dependant on the two previous matchups. For example, Team A is facing off against Team B, and Team C is facing off against Team D. If Team A and Team D are chosen in the pickems to win, which means the next round's bracket should only have Team A and D in the dropdown menu. If Team B and C win, only Team B and C should be in the dropdown menu.
To simplify it, one dropdown once selected sends its value to a recieving dropdown, and another completely different dropdown also once selected sends its value to the recieving dropdown.
Copy link to clipboard
Copied
var Choice = this.getField("UpperFinal");
if(event.willCommit)
{
//clear field here, don't know command for it
switch(event.value){
case "Team A":
Choice.addItem("Team A");
break;
case "Team B":
Choice.addItem("Team B");
break;
}
}
Then for the second matchup
var Choice = this.getField("UpperFinal");
if(event.willCommit)
{
//clear field here, don't know command for it
switch(event.value){
case "Team C":
Choice.addItem("Team C");
break;
case "Team D":
Choice.addItem("Team D");
break;
}
}
If this works, if Team A and Team D are selected from the two dropdown lists, the "UpperFinal" dropdown list should populate with only Team A and Team D. If Team B and Team C are selected, "UpperFinal" should only populate with Team B and Team D.
Copy link to clipboard
Copied
If you set it to clear items in both dropdown fields, then it will clear also first item added when you select item from second dropdown, so it's better to set it to clear items only in first field and in second set it to clear second item if you change selection.
In first dropdown use this:
var Choice = this.getField("UpperFinal");
if(event.willCommit){
Choice.clearItems();
switch(event.value){
case "Team A":
Choice.setItems(["Team A"]);
break;
case "Team B":
Choice.setItems(["Team B"]);
break;}}
In second use this:
var Choice = this.getField("UpperFinal");
if(event.willCommit){
Choice.deleteItemAt(1);
switch(event.value){
case "Team C":
Choice.insertItemAt("Team C","", 1);
break;
case "Team D":
Choice.insertItemAt("Team D", "", 1);
break;}}
Depending on your needs it can be refined further by adding blank choice if you wish "UpperFinal" doesn't show value until you select it.
Since we added to clear items in first dropdown make sure you also make first selection from first dropdown then second dropdown.