Copy link to clipboard
Copied
Ok guys and gals. I'm going nuts here. I have been doing a lot of research on a dynamic drop down list for adobe acrobat pro XI. I've seen a few things but nothing is working. Here is what I am trying to do. I have two drop down boxes in a form titled "Status" and "Rank." I want Status to have two labels to chose from; NCO and OFFICER. In the "Rank" field I want the list of either all of the NCO or Officer ranks to appear for selection based upon which option is chosen in the field "Status." I tried this script which has gotten me the closest but only displays the data in the "Rank" field for NCO when NCO is the first item in the list in the "Status" field and the data that does appear in the "Rank" field does not display as drop down options. Rather, it displays as a line of text with commas. If I chose the Officer item as the 2nd item in the list, I get no change in the "Rank" field. It stays populated with the original NCO data. grrrrrr. This script may be too simple and not what I need but it functioned closer than anything else I found. Here is what that script looks like:
switch (event.value) {
case "NCO":
this.getField("Rank").setItems("PV1,PV2");
break;
case "Officer"
this.getField("Rank").setItems("2LT, 1LT");
break;
}
You need to use it as the custom Validation script. Also, make sure to tick the option to commit the selected value immediately, under the Options tab.
Copy link to clipboard
Copied
Oh, yeah....almost forgot.
I am running Windows 7 Enterprise
64 bit OS
Adobe Acrobat XI Ver: 11.0.20
Copy link to clipboard
Copied
The values need to be individual strings in an array, like this:
setItems(["PV1", "PV2"])
Copy link to clipboard
Copied
Thank you so much for your attention. I tried it and saw the obvious errors in my last submission. The new code did make a change but were not quite there. Now, the Rank field (the Target field) is not populating with any data. It is blank for either option I select in the Status Field. I am inserting a picture to display the exact code as is cut and pasted into the pdf from Notepad. I tried removing the space between the comma and PV2. Didn't think it would really help but I tried. No go.
Copy link to clipboard
Copied
This thread is where I originally got the script:
https://forums.adobe.com/thread/1622758
I'm looking letter by letter and I just don't see anymore mistakes. This script seemed to work for others. I just don't know.
Copy link to clipboard
Copied
Where did you place the script, exactly?
Are you seeing any error messages in the JS-Console after you change the value of the drop-down?
Spaces after a comma are not an issue.
Copy link to clipboard
Copied
Again, I thank you very much for your time. No, sir. No errors in the console and I did activate it. It does pop up occasionally when I execute an error but it is not giving me any warnings in this case. I put the script into the actions tab in the properties box. See below:
Here are my results:
Copy link to clipboard
Copied
You need to use it as the custom Validation script. Also, make sure to tick the option to commit the selected value immediately, under the Options tab.
Copy link to clipboard
Copied
You da' maaaaaan! Thank you, Thank you, Thank you! It works perfect. Question then, how do I determine when to enter scripting in the actions tab or the validation tab?
Copy link to clipboard
Copied
That's quite complex. Basically it depends on when to trigger the code that you want to execute, what you want to do with that code, and what kind of information is required at that moment.