I do have one more question in order to get started. I've read your Where does JavaScript Go article (https://acrobatusers.com/tutorials/so-where-does-javascript-go-in-acrobat/) and I see where to add a JavaScript routine in tht text field properties window, but can't figure out how I'd add a JavaScript function that is used by all scripts, such as:
function find(ocgname){
var layers = this.getOCGs();
for(var i=0; i < layers.length; i++) {
if(layers[i].name == ocgname) return layers[i];
}
return null;
}
that would be used by all scripts entered in a text field's properties window, each text field's script would pass its specific argument to find(). How would function scripts be added to a PDF to be called by each function? Or, is the intent of Adobe to NOT have universally available functions, treat each text field as a stand alone field?
Can you point me to an article about that? I'll keep searching in the meantime.
To define a document global function, you need a document level script.
https://www.pdfscripting.com/public/Document-Level-Scripts.cfm