Saved PDF does not restore data properly when reopened

Avatar

09-11-2008

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

Replies

Avatar

Avatar

pguerett

Avatar

pguerett

pguerett

10-11-2008

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

Avatar

10-11-2008

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

Avatar

pguerett

Avatar

pguerett

pguerett

10-11-2008

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

Avatar

Avatar

pguerett

Avatar

pguerett

pguerett

10-11-2008

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

10-11-2008

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

Avatar

pguerett

Avatar

pguerett

pguerett

11-11-2008

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

Avatar

pguerett

Avatar

pguerett

pguerett

11-11-2008

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

11-11-2008

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

Avatar

pguerett

Avatar

pguerett

pguerett

11-11-2008

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?