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
BedrockMission!

Learn More

View all

Sign in to view all badges

Can i reference an external Javascript?

Avatar

Avatar
Level 1
livecyclecoder
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
livecyclecoder
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile
livecyclecoder
Level 1

06-06-2019

Hello,

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")

     {

     dropdown.addItem("xyz1");

     dropdown.addItem("xyz2");

     dropdown.addItem("xyz3");

     }

     ....

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?

Accepted Solutions (0)

Answers (5)

Answers (5)

Avatar

Avatar
Validate 1
Level 4
MinusZero
Level 4

Likes

30 likes

Total Posts

326 posts

Correct Reply

54 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Validate 1
Level 4
MinusZero
Level 4

Likes

30 likes

Total Posts

326 posts

Correct Reply

54 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile
MinusZero
Level 4

06-06-2019

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.

Avatar

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile
_Bruce_Robertson
MVP

06-06-2019

Hi,

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

Regards

Bruce

Avatar

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct Reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct Reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile
radzmar
MVP

06-06-2019

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 xfa.datasets.data. 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.

Avatar

Avatar
Level 1
livecyclecoder
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
livecyclecoder
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile
livecyclecoder
Level 1

06-06-2019

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!

Avatar

Avatar
Boost 5
Level 4
BarlaeDC
Level 4

Likes

23 likes

Total Posts

160 posts

Correct Reply

30 solutions
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Applaud 5
View profile

Avatar
Boost 5
Level 4
BarlaeDC
Level 4

Likes

23 likes

Total Posts

160 posts

Correct Reply

30 solutions
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Applaud 5
View profile
BarlaeDC
Level 4

06-06-2019

Hi,

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.

Regards

Malcolm