These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Conditional combo boxes not associating

wbfritz
Registered: May 31 2011
Posts: 2
Answered

Hello, all. I am working on a fillable form in Adobe X Pro (Version 10.0.3).
 
I used a custom keystroke code to make the options available in one combo box dependent on the value selected in another. Unfortunately, the values don't show up in the second combo box once the first value is selected. I was sure to make all the first box's options output sequentially starting at 0. Can anyone see any problems with the code below or offer any suggestions to make this work?
 
//Custom Keystroke script for combo box
(function () {
 
if (!event.willCommit) {
 
//Set up an array for arrays of specific triggers corresponding to the export values in this combo box
var aTriggers = [];
aTriggers[0] = ["NA", "1a. Relay board single conductor", "1b. Relay board two conductors", "1c. Circuit board, data over wire", "2a. Multi-component no circuit board, TCR", "2b. Multi-component no circuit board, SCR", "3a. Single transistor", "3b. Single SCR", "3c. Single relay", "4a. Camera flash firing device (high voltage)", "4b. Light ballast firing device (high voltage)", "4c. Battery pack firing device (high voltage)", "4d. Inverter/UPS firing device (high voltage)", "4e. Custom built firing device (high voltage)", "X. OTHER"];
aTrigger[1] = ["NA", "1. Mobile phone - CDMA", "2. Mobile phone - GSM", "3. Handheld radio - HF", "4. Handheld radio - VHF", "5. Handheld radio - UHF", "6. LRCT - VHF", "7. LRCT - UHF", "8. Custom w/COTS VHF receiver board", "9. Custom w/COTS UHF receiver board", "10. Custom 1 board VHF", "11. Custom 2 Boards VHF", "X. OTHER"];
aTrigger[2]=["NA", "1. Clothes pin", "2. Switch", "X. OTHER"];
aTrigger[3] = ["NA", "1. Suicide Switch", "X. OTHER"];
aTrigger[4]=["NA", "1. Mechanical clock mechanism", "2. Water displacement timer", "X. OTHER"];
aTrigger[5] = ["NA", "1. Pyrotechnic", "X. OTHER"];
aTrigger[6] = ["NA", "1. Custom circuit/board", "2. Electronic clock mechanism", "X. OTHER"];
aTrigger[7] = ["NA", "1a. Switch, button switch", "1b. Switch, pedal", "2. Pressure, no metallic contacts", "3a. Plate, ball bearing contacts", "3b. Plate, saw blade contacts", "3c. Plate, combination saw blade and metal sheet contacts", "3d. Plate, metal sheet contacts", "3e. Plate, steel rod contacts", "3f. Plate wire contacts", "3g. Plate, nail contacts", "3h. Plate, bolt contacts", "3i. Plate, carbon rods", "3j. Plate, folded plastic switch", "3k. Plate, foil contacts", "4. Wire, crush wire contacts", "X. OTHER"];
aTrigger[8] = ["NA", "1. Rodent trap", "2. End pivot", "3. Center pivot", "4. Pressure/Pressure Release, end pivot", "5. Pressure/Pressure release, center pivot", "X. OTHER"];
aTrigger[9] = ["NA", "1. Passive infrared", "2. Active infrared", "3. Light/Photocell", "4. Radio frequency detector", "5. Acoustic", "6. Radar", "7. Magnetic", "X. OTHER"];
aTrigger[10] = ["NA", "1. Clothes pin/Trip wire", "2. Wire loop", "X. OTHER"];
aTrigger[11] = ["NA", "1. Collapsing circuit, relay", "2. Collapsing circuit, custom circuit/board", "3. Tilt mercury", "4. Tilt weighted (non-mercury)", "5. Light, LDR", "6. Wire loop, pull", "7. Clothes pin switch (NOT trip wire)", "8. Trembler", "X. OTHER"];
aTrigger[12] = ["NA", "1. Pull/Release", "2. Release", "X. OTHER"];//Get the export value of the selected item
var ex_val = event.changeEx;
//Populate the combo box field with the triggers
getField("Switch2").setItems(aTrigger[ex_val]);
}
 
})();

My Product Information:
Acrobat Pro 10.0.2, Windows
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
Accepted Answer
Are you getting any errors in the JavaScript console?

What are the optional values for the first drop down box?

Do you have the 'commit immediately' option selected for the first combo box?

Do you have all the field names and variable names pro pertly spelled and capitalized?

Are the variables "aTrigger" and "aTriggers" the same variable or different variables?

A sample of the form would be helpful.

George Kaiser

wbfritz
Registered: May 31 2011
Posts: 2
George, the last point you noted was the one that solved the problem. In all my reviews, I never caught that I had dropped the "s" off of "aTriggers". A simple typographical error. Problem solved, and everything works smoothly now. Thanks for your assistance.