Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Saving to an XML file

Avatar

Former Community Member

I've looked, but have never seen a direct answer. Where can I get a step by step tutorial on how to set my form up to save it's data to an xml file when they click a button?

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

There are menu choices in Acrobat and Reader to save Form data and you can put a button on the form to execute on the click event the command xfa.host.exportData("", false)

This will bring up a menu and allow the user to choose a filename for the data file. You cannot save the file without the user picking a filename (that is against the security model).

Hope that helps

paul

View solution in original post

5 Replies

Avatar

Correct answer by
Former Community Member

There are menu choices in Acrobat and Reader to save Form data and you can put a button on the form to execute on the click event the command xfa.host.exportData("", false)

This will bring up a menu and allow the user to choose a filename for the data file. You cannot save the file without the user picking a filename (that is against the security model).

Hope that helps

paul

Avatar

Former Community Member

The filename used will be derived from the name of the PDF file. If your file was called MyForm.pdf then the suggested name will be MyForm_data.xml. The user can override this if he/she chooses but you cannot change that name programmatically.

Paul

Avatar

Former Community Member

What if I used xfa.host.exportData(filename, 0) on a click event? Why have this option if it won't work?

Avatar

Former Community Member

It used to work (a long time ago), but with the advent of hackers ....the stance was taken that you cannot do anything without the users knowledge.

That being said, that parameter can be passed if you certify the document. Certifying the document means that the user is accepting the creator of the document as known and they will allow automation of certain functions for them. To do this you will need a digital certificate to certify with and then each user that opens your document will have to have that certificate in a trusted store (typically the browser store) on each machine that they open the document on. This trusted store location is a setting in Acrobat. Unless you are controlling the desktops of all people who are going to open your document this certification setup is a lot more trouble than what it is worth.

Paul

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----