Copy link to clipboard
Copied
I need to autopopulate a drop down list based an a choice in anothe drop down list, for exemple:
In "Dropdown1" someone choose "Portugal" I need that appears in my "Dropdown2" -» "2220"; "2300"; "2523", for example, I´ve see the fallow code but not sure is this result for me, some help please? I´m using Acrobate PRO DC
function updateDropdown() {
var f1 = getField("DropdownList1");
var f3 = getField("DropdownList2");
var s1 = event.target === f1 ? event.value : f1.valueAsString;
if (s1 === " ") {
f3.clearItems();
} else {
f3.setItems([" ", s1, s2]);
}
}
If the second field is called "Dropdown2" the basic code to do it is the following (to be used as the custom Validation script of the first drop-down):
if (event.value=="Portugal") this.getField("Dropdown2").setItems(["2220", "2300", "2523"]);
Copy link to clipboard
Copied
If the second field is called "Dropdown2" the basic code to do it is the following (to be used as the custom Validation script of the first drop-down):
if (event.value=="Portugal") this.getField("Dropdown2").setItems(["2220", "2300", "2523"]);
Copy link to clipboard
Copied
Works just perfectly, much more simple that I thought, thanks a lot Try67.
Copy link to clipboard
Copied
I have put the fallow code with more than 1 option, but the code only assume Portugal (first option), when I choos Germany in my first dropdown, only appears Portugal options, what I did wrong?
if (event.value=="Portugal") this.getField("Dropdown3").setItems(["Choose CC","2000 OVA/CUC"]);
if (event.value=="Germany") this.getField("Dropdown3").setItem(["1000 K.Automotive Holding", "1100 ATT", "1200 ISE","1300 HAG"]);
Copy link to clipboard
Copied
OK, I already know why it doesn´t works, it´s missing a "s" in Germany line code in "SetItem", wotks now just fine, thanks a lot once again