Expand my Community achievements bar.

Saved PDF does not restore data properly when reopened

Avatar

Former Community Member
I have a simple PDF I created in Livecycle Designer where I fill in some input fields and save the PDF. The problem I am having is when I save the PDF, and then reopen it, the data in the input fields are no longer where I originally typed them in.



The PDF is saved as a version 8 Dynamic PDF and the Form properties is set to 'Automatic' (that is, not manual). If anyone can help me, I would be so appreciative.



My PDF can be downloaded at:

https://share.acrobat.com/adc/document.do?docid=bcb8f652-f468-4c81-b221-65a5e397c89d
12 Replies

Avatar

Former Community Member
Works fine in version 9 of Acrobat ....which product and version version are you testing in?

Avatar

Former Community Member
Hey Paul, Thanks so much for taking a look at this.



It totally fails for me on Acrobat 8 and Acrobat 9.



If you click the "Fill in Room Number". Save the form. Close the form. Open the form. On my Acrobat 9 it bunches all the data instead of having the data spread out as it across the different room types.



I Reader Extended this form and ran it on Reader 9 and got the same error in how it opens/stores the data.

Avatar

Former Community Member
Ok Now I see what you mean .....I will have a look and see what I can figure out.

Avatar

Former Community Member
That form is totally messed up .....I cannot see how you get 5 sections and 7 room lines from your initialize script. I had a look at the XML source and did a search for _rooms and found the structure towards the bottom. Did you have a schema or embed a schema and one point in time?



If I hit ctrl_A to copy all objects onto a new form and try it again I get the behaviour I expect.

Avatar

Former Community Member
Hi Paul,



The reason pasting all objects in a new form works is because your new form is probably saved as a Static form. Save that new form as a Dynamic form and you'll get the same problems as my original form.



I agree that it makes no sense how the initialization script creates 5 sections. I can't figure that out either.



Scott

Avatar

Former Community Member
Nope it makes no difference if it is static or dynamic it gets initialized with 3 sections and 1 room subform under each section....as the code would indicate.



Where the additional 2 sections and the additional 4 rooms subforms come from I have no idea.



Also if I add a messagebox to indicate each time the initialzation script on P1 fires it behaves properly.



I suggest that you create a new form and copy all objects to this new form and continue with that one. I will continue to look at this one and see if I can figure out what is going on. Note that it could take some time.

Avatar

Former Community Member
I think I figured this out. The code to add subforms called sect is executing on the initialize event of the P1 subform. The initialize event is running twice (once on the server (pdf creation) and once on the client inside of acrobat when it is rendered. If you move that code to the Doc Ready event the form will display correctly. I put a textfield on the form this populated when the initialization script is run. This tells me how many times it runs.



Now back to your original problem.



If I run your script to populate the rooms and re-open it is getting messed up again because the Doc Ready event is running each time you open the form. Instead of trying to initialize the form programatically if you use the Initial count on the binding tab of the subform all of this initiazation problems go away.



Are you intending on having multiple rooms subforms per section or will it always be one to one? if there is a one to one mapping change the checkbox on the binding tab that indicates that multiple subforms are available.

Avatar

Former Community Member
Hi Paul,



I just created a new PDF and put the script in the DocReady event of P1 and yes, it initializes correctly now. Can you explain your last two paragraphs, I didn't quite understand what it said or asked.



I don't know if I'm answering your question, but I will have many rooms under a single room type (just like the initialize script shows).



thanks for all of your help, I've struggled alot with this.



Scott

Avatar

Former Community Member
Each time that you open the form the DocReady will fire. In your code you do not check to see if there is already data in the form so it will add three next sect subforms each time a user opens the file.



So it most cases we do not programmatically setup the form for initial use. We give you initialization parameters like the initial count for the subforms so that we do not run into this problem.



So I guess my question would be why are you using code to set an initial state for your subforms?

Avatar

Former Community Member
i only put this script in the initialization routine to illustrate my example. I don't do this in my actual PDF, so really, the problem of the odd sections getting created was not the real issue.



The main issue was just the saving and repopening of the PDF and how it would restore properly. So here is where I am now. I've created a new form like you mentioned, saved it as a dynamic form, also filled in the room numbers. But when i reopen it, i still don't get the room numbers restored properly. I read that you got it working, but I must still be missing something. Can you possibly email me your PDF at scottsheck@yahoo.com. Maybe then i can figure out what I'm missing. I'm also using Livecycle version 8.05, not 8.2



Thanks,

Scott

Avatar

Former Community Member
No I only have it working if there is a single room under the sect node. We are now dealing with a binding issue. If you mail me your finished form I will have a look at the binding now.

Avatar

Former Community Member
Here is my latest pdf. If you push the button to fill in the room numbers, then save it, then reopen it, the room numbers are not in the restored in the original spot.



https://share.acrobat.com/adc/document.do?docid=d073d5e2-caef-4e98-9a21-122599645719



thanks Paul