These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Export data to xml file whose filename is generated from text field

jimjarratt
Registered: Jul 31 2006
Posts: 2
Answered

When using xfa.host.exportData("",0) to export form data to an xml file, how could one pull the filename from a text field in the form (using javascript)? I know xfa.host.exportData("filename.xml",0) would give me a file called filename.xml, but I want the name of the file to be dynamic. Of course, if the text field is blank, then the filename would be blank in the Save As dialog box (I hope). LiveCycle Designer 8. Thanks.

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
About the exportData method the LiveCycle Scripting Manual says:

"For security reasons, if you provide the first parameter (that is the path and filename) , the exportData method executes only when performed on certified documents. If you do not provide the first parameter, the document does not need to be certified and the user is prompted to provide a location and file name.

So a script like...

var MyFileName = textfield1.rawValue;
xfa.host.exportData(MyFileName, 0);

... will not work, as long the form is not certified (for $).

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

krm240
Registered: Apr 17 2009
Posts: 95
Question on this
What happens if you use a custom script similar to the trusted function save as?
Would that work?

Asking as I would like to have a similar script save the xml data in a predetermined location with predetermined names...