Drop Down to Fill Text Box
- June 6, 2023
- 1 reply
- 1301 views
I am trying to create an order form in Acrobat Pro.
I need a drop down box with three choices, I have placed four choices with two spaces being the default choice. I have given all four choices export values of 0, 1, 2, and 3 respective of how they appear as choices in the drop down box. I am trying to populate a text box directly under the drop down box with instructions based on which choice is picked in the drop down box. I have chosen Commit selected value immediately for the Option in the drop down box. I am a bit confused under the Add an Action portion. Do I want mouse Up, Down, Enter, Exit....
I have it set now for Mouse Enter and Run a JavaScript
and here is my code:
(function () {
if (!event.willCommit) {
// Set up an array of options. \r = carriage return
var aInst = [];
aInst[0] = "";
aInst[1] = "Starting Dose (Weeks 1-12) \rInstructions: \rStep 1: INJECT 0.25mg (0.05mls OR 5u on syringe) SQ ONCE A WEEK FOR 4 WEEKS. \rStep 2: INJECT 0.5mg (0.1mls OR 10u on syringe) SQ ONCE A WEEK FOR 4 WEEKS. \rStep 3: INJECT 1mg (0.2mls OR 20u on syringe) SQ ONCE A WEEK FOR 4 WEEKS.";
aInst[2] = "Second Dose (Weeks 13-17) \rInstructions:\rStep 1: INJECT 1.7mg (0.35mls OR 35u on syringe) SQ ONCE A WEEK FOR 4 WEEKS.\rStep 2: INJECT 2.4mg (0.5mls OR 50u on syringe) SQ ONCE WEEKLY THEREAFTER.";
aInst[3] = "Maintenance Dose (1 Month)\rInstructions:\rStep 1: INJECT 2.4mg (0.5mls OR 50u on syringe) SQ ONCE WEEKLY THEREAFTER.";
var ex_val = event.changeEx;
var tt = aInst[ex_val];
getField("TT").value = tt;
}
})();
The text box keeps coming up as undefined. Any help would be greatly appreciated, I have the distinct feeling it is something simple this non coder is missing. I am not getting errors in the script editor, but it is not operating as I am hoping.
