Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

Can i reference an external Javascript?


Level 1


I made a dynamic PDF-form in Adobe Live Cycle which has 4 pages.

On each page there are 16 similar rows, each rows contains 3 different elements.

The first element is a text field, the second element is a Drop Down Menu and the third element is an EAN13-Barcode.

Once the user entered a valid code and ".exit" the text field the DropDown-Menu gets updated and only has specific choices depending on the value of the text field:

if(this.rawValue == "9H23")







After the user selected a specific value in the DropDown-Menu, the related Barcode gets updated via JavaScript:

if(this.rawValue == "xyz1")


     EAN.rawValue = "1234567891011";



The Challenge:

Sometimes we get new products and i have to update the PDF-form. It is not only time consuming but also prone if i update all 16 rows on each page manually. So my question is: Is there a way to reference an external JavaScript code? Or load the same JavaScript code for all text fields and Drop Down Menus so i don't have to copy&paste the code for each element? Is there another way to get this problem solved?

5 Replies


Level 5


How do you generate the finished form? as it may be possible to merge it with a data file, therefore you could change the code so that it looks up that data file, and any time you need a change you just change the data file and re-release.

This is the documentation for what I am thinking.




Level 1

Hey BarlaeDC,

thanks for your answer. I generate the dynamic PDF in Adobe's LiveCycle Designer. Then i save it as a dynamic PDF. Afterwards different users open it on their computers which only have Adobe Acrobat Reader. They fill out the form and than they print it with something what is called "Cute PDF-Writer", which generates the finished form as an static PDF document.

I also thought about connecting the PDF with the Database but i dont know if thats possible and how.

At the Moment i am using a script i wrote in python which lookup the Database ( simple csv-file) and generates the JavaScript-Code i need. I am pretty sure there must be a better way to handle this problem. But i dont know how . If anyone has an idea, i'd really appreciate it!


Level 10

With Acrobat Reader you cannot use data connections, however you can import text files. And since XFA forms are XML-based and XML files are technically just text files, you're can import XML-files into your form.

Here's a description how to do that.

LiveCycle Blog: XML per Skript in Adobe Reader importieren//Import XML via Script into Adobe Reader

So in your form there is a default dataset called "data", which is located under This is where your form stores the data entered by the user. Below the node xfa.datasets you're able to create as many other datasets as you need to store data in your form like an embedded database.

xfa.datasets.loadXML(yourImportedXML, false, true); //Add a new dataset

So what you need is a XML file, that represents your database, a script to import that into your form and finally some scriptings or data bindings to the imported dataset to populate your fields.


Level 10


Another option might be to create a "fragment" out of the row, then you can use this fragment in the other tables, meaning you only have the one place to update.

There's more about fragments at Adobe LiveCycle ES4 * Creating and inserting fragments




Level 7

It might be a bit low tech, but i use in-form storage for some forms i have done. I have hidden text fields and built a dialog for updating the textfields within. I never need to modify the actual form in livecycle, i just save new information into it as needed.