Expand my Community achievements bar.

How to upload data from XML-file to LiveCycle Designer blank form?

Avatar

Former Community Member
Hello!



First of all, of course, I used "Forum Search" link, but it doesn't helped me... So, my situation is:



Using LiveCycle Designer I created a new form. This is very simple form, it contains only 4 fields - "First Name", "Middle Name", "Surname" and "Your Comments". Also there is a button "Submit". For every field I chose a name in "Name" box in "Binding" tab of Object palette - "FirstName", "MiddleName", "Surname" and "Comments".



When I fill in the form by Adobe Reader and then press "Submit" button, I can save an XML-file containing data I filled. My problem is I can't to upload data from existing XML-file to my form. I don't know how can I do this. I browse documentation and found out that I should create a new Data Connection with sample XML data, but what should I do then - I really don't know. After I create a connection to my XML-file, I can just bind XML-items with my fields...



If you can help me, please, give an advice. Or say, what documentation topic I should read. Maybe something else...



--------------------------------

Kindest regards and best wishes,

Yuriy V. Vorobev
4 Replies

Avatar

Former Community Member
Try: $host.importData("").



Look into using your submit button as a save feature. We were doing this and were told that this ability was an oversight and in future releases they would be removing the ability to simply save.

Avatar

Former Community Member
Thank you, Pyne!



Thanks to your advice I found in Help-system of Adobe Designer two methods: exportData( ... ) and importData( ... ).



But, to say the truth, I don't know how can I use them. I'm using Adobe Designer just a week, so now I know only how to place the fields, buttons and other elements to the blank form. Also I know, how use SUBMIT-button.



So, can you explain me, how should I use these methods? :)

I tried to do the following:



1. In my form I placed a button and changed a caption of this button;

2. In the top of the screen (but lower the Adobe Main menu) I found a panel, where I can choose an event and Script-type (FormCalc or JavaScript). Also there is a field, where I can write some code.

3. I enter in this field the following code for "click" event:

host.importData("")

4. I saved the form and opened it to preview with Adobe Reader.

5. When I pressed to my button, I received an error message:

"Script failed (language is formcalc; context is

xfa[0].form[0].form1[0].#subform[0].Button1[0])

script=host.importData("")

Error:"

and [OK] button.

Also I tried to enter "$host.importData("")",

but the result was exactly the same...

6. For another button I used "$host.exportData("")" with the same error...



Now I'm looking for how to solve these errors, but, I suppose, I need again your advice.



--------------------------------

Kindest regards and best wishes,

Yuriy V. Vorobev

Avatar

Former Community Member
I found a solution of my problem - it's simply need to use Adobe Acrobat Standard / Professional (because they are support feature of saving PDF-files).



Using Adobe Acrobat, I can save and reload XML-data to my form

(by xfa.host.exportData("") and xfa.host.importData("") on click event for buttons).



And now I have another question - can I save and reload XML-data from file, using Adobe Acrobat Elements?

Avatar

Former Community Member
I know this is a post from long ago, but perhaps it will help someone with the same error.



The specific error message you recieved:

Script failed (language is formcalc; context is

xfa[0].form[0].form1[0].#subform[0].Button1[0])

script=host.importData("")

Error:"



indicates that perhaps you should have tried javascript for the type, not formCalc. For my forms, I just default them as Javascript -- I get tired of seeing those darn formcalc errors :)