Copy link to clipboard
Copied
I need some help. using the setItems command the items appear in the list box selection but when i click on one of the items it always reverts to the first item in the list. Here is the script im using. also the items do not clear if I type a diffeent value other than the 4 in the example below into the "route" text box. Eventually I will need to put about 30 routes in. Thanks for you help!
var l = this.getField("route1");
var R = this.getField("route").value;
if (R == 655) {l.setItems(["KTYR KDFW" , "KDFW KTYR"])}
else if (R == 658) {l.setItems(["KPSN KTYR KDFW", "KDFW KPSN"])}
else if (R == 660) {l.setItems(["F05 KSPS KDFW", "DFW KSPS F05" , "F05 KDFW" , "KDFW F05"])}
else if (R == 666) {l.setItems(["KABI KDFW", "KDFW KABI"])}
else i.clearitems();
Each time you call setItems it reverts to the default item in the list (the first one)... You need to use this code in an event that isn't constantly firing (like the Calculate event does), or add to it a command that preserves the currently selected item (if possible) after setting the items list. But the former is much better.
Copy link to clipboard
Copied
Where does you use the script? Don't use the script as calculation.
Copy link to clipboard
Copied
Thanks. Yes I had it as a calculation but I moved it to validation and it works correctly but seems to be giving some platforms fits crashing acrobat or slowing it down a lot. So I'm still working on it.
Copy link to clipboard
Copied
Each time you call setItems it reverts to the default item in the list (the first one)... You need to use this code in an event that isn't constantly firing (like the Calculate event does), or add to it a command that preserves the currently selected item (if possible) after setting the items list. But the former is much better.
Copy link to clipboard
Copied
Ok thanks for that. I'm still figuring it out.