Expand my Community achievements bar.

SOLVED

Script for using XML data file to pre populate form opened using Reader

Avatar

Level 2

I need to  pre populate five fields when the user opens the form using Acrobat Reader (name title, address, etc). The values will be stored in an xml data file in the same directory as the form (no database connections or web services needed). I've tested the xml and form structures using Forms -> Manage Form Data -> Import Data and all works fine. Now, I need to mimic this behavior programmatically so it will work using only Acrobat Reader. I can't find the magic java script command to import the data (I've tried xfa.host.importData and xfa.datasets.data.loadXML to no avail). Requiring purchasing Pro or the Livecycle server product is not an option. This seems like a basic requirement so I am hoping I am just being stupid and missing the obvious. Thanks.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

Unless you are reader enabling the form with LiveCycle Reader Extensions ES, then users with Reader will NOT be able to import (or export) XML.

Summary here: https://acrobat.com/#d=3lGJZAZuOmk8h86HCWyJKg

Based on your description you are looking at options 2 and 3, users with Reader.

Sorry,

Niall

View solution in original post

5 Replies

Avatar

Correct answer by
Level 10

Hi,

Unless you are reader enabling the form with LiveCycle Reader Extensions ES, then users with Reader will NOT be able to import (or export) XML.

Summary here: https://acrobat.com/#d=3lGJZAZuOmk8h86HCWyJKg

Based on your description you are looking at options 2 and 3, users with Reader.

Sorry,

Niall

Avatar

Level 2

Niall:

Thank you for the on-point reply. Not the news I wanted to hear, but I appreciate the rapid response.

George

Avatar

Level 2

Niall:

One more follow-up question. After reviewing the document below, if I go with Option 1 and require Acrobat Pro what is the java script command that performs the equivalent function as Forms -> Manage Forms Data -> Import Data... ? (xfa.datasets.data.loadXML and xfa.datasets.data.loadXML do not seem to do the trick.) Thanks,

George

Avatar

Level 10

Hi George,

importData(); should work. A dialog window will open and the user will be prompted to select the xml file that they want to import. If you specify the actual file as a parameter, then the form will need to be certified. This leads to problems of maintaining the certificates and users having to confirm that they accept the certificate (trust it).

Good luck,

Niall