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

Form Data Clears on Reopen - Loop Issue?

infrared
Registered: Jun 3 2008
Posts: 7
Answered

Hi all, i have created an invoice form (Mac Acrobat 8.1.2) using various drop down menus to auto-populate fields.

Everything within the form works as it should however, when saved and reopened all the data auto-populated from the drop-down menu disappears. Have tried solutions mentioned by others in these forums, namely adding these properties:

DataEntry = No
AllowAdditions = Yes

It partially solved the problem, in so much as when the document opens, the data flashes up for a split second before disappearing again. Further investigation has led me to believe that a "for" loop within the script may be causing it to reset itself - i removed the code and when reopened the data remains - however the auto-populating fields also stopped working.

I think i need to change the for loop so it isn't constantly running but is only called when needed, this is where i need help pleaseā€¦

My Product Information:
Acrobat Pro 8.1.2, Macintosh
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Without actually knowing what the loop is doing we would be hard pressed to give you any specific answers. But I'll give it a try.

First, since this is all happening when the document is opened I would have to assume that the script in question, the one with the loop, is in a document level script? The code in this loop must be either directly writing over field values or causing events in fields on the form that are overwriting the field values.

Field events can be a tricky things to work with. Each event causes other events to trigger. If code is written poorly it can create uncontrolled cascades of events.

So, which events are you using? what is going on in this infamous for loop? What else is going on at Document Open?


Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/]http://www.adobe.com/devnet/acrobat/[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

infrared
Registered: Jun 3 2008
Posts: 7
Thomp, thanks for replying. I have however since managed to solve the problem. FYI it was a document level script allocating values for drop down menus (idea being to set them in one place only to save updating multiple instances of drop down menus).

Turns out that as it opens it sets all the values and then scrubs previous data. Solution: delete this for loop and manually enter drop-down values.

i have since found out, that i could have also inserted an extra line in the for loop which checks for existing data and if found sets value to that else continue as before.

But like i said, thanks for replying. I'll no doubt be on here in future as i learn the ins and outs.