Copy link to clipboard
Copied
I'm looking for a way to allow the use of multiple copies of a property, such as a list of states, for a single PDF form. Most of the information resource that I've found are for the opposite purpose, like using a filter on an original set of values in a second property.
There is an entry from 2012 about LiveCycle that looks similar to what I want to do:
This doesn't seem to fit Adobe Acrobat DC. Does anyone have insights, or another idea about how to accomplish this? It would certainly be nicer to be able to manage an array in one place that is used to populate other dropdown properties. (The full list would need to be avaiable for each copy of the property. Think of a form that lists multiple addresses on the same PDF.)
Copy link to clipboard
Copied
If I get what you mean, then the answer is yes.
For example,
Docuemnt Script:
var myItems = ["A","B","C"];
Script somehwere else:
this.getField("MyField").setItems(myItems);
This code sets the items in the dropdown/list named "MyField" to myItems.
Here's an article that shows a much more sophisticated version of this.
https://acrobatusers.com/tutorials/js_list_combo_livecycle/
You'll find a great deal more about fancy list handling here:
https://www.pdfscripting.com/public/List-Field-Usage-and-Handling.cfm
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
If I get what you mean, then the answer is yes.
For example,
Docuemnt Script:
var myItems = ["A","B","C"];
Script somehwere else:
this.getField("MyField").setItems(myItems);
This code sets the items in the dropdown/list named "MyField" to myItems.
Here's an article that shows a much more sophisticated version of this.
https://acrobatusers.com/tutorials/js_list_combo_livecycle/
You'll find a great deal more about fancy list handling here:
https://www.pdfscripting.com/public/List-Field-Usage-and-Handling.cfm
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
Thanks for this detail, Thom. It makes the process very clear, and it is similar to what I'm trying to accomplish. The Master List, for my purposes would be used to add new properties that would be a copy of the States list (with ["State","XX"] as the list entries. When I want to add another State to the list, ideally, I could add that to the Master List in the Java script and it would update the list properties using that list.
In your example form, I added "NewItems: [["State","code"]]," following the line "var oAssemblyParts = {" but this does not show up as an option for the Assembly field. I'm looking at ways to use an event to update the list, possibly from a hidden property on the form. However, I have a different issue to resolve first. I set up the list variable using the format of brackets to list the state followed by the Export value (two-letter abbreviation). Only the last entry in the list to be returned, with options being the item or its export value (Wyoming, or WY). I've been looking for ways to overcome this, and hoping this is possible (not a limitation). I need to be able to use the two-letter export value for another purpose, but want users to choose the familiar description (less chance of mistake).
Copy link to clipboard
Copied
It is important that any changes you make exactly follow the JavaScript syntax. Very small details are important, so syntax issues are a constant problem, even for the experts. Did you check the console window for errors? In fact, if you want to update the list, the best way to do it (because this is a one time operation) is to run code in the console window. I'd also suggest you do any code testing in the console window.
You'll find a tutorial on the console here:
https://www.pdfscripting.com/public/Free_Videos.cfm#JSIntro
There are no problems using the export value in any way you want. Please be more specific (and clear) about what you to accomplish.
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
Please disregard my last reply. The process ran so slowly that I thought it wasn't working. A hidden property will allow me to use this to update the multiple user-selected copies of the property when needed.

