Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Dynamic opened boxes not visible after saving and closing

Graham_Calhoun
Level 4
Level 4

I am using some some text boxes which show or hide depending on what is checked/unchecked. This all works great. The problem I am having is when someone fills the form out and then saves it as a .pdf when it is reopened the hidden fields do not show. They are still there, with their data intact. By clicking the yes/no button that activated them in the first place, they will reappear with data. Any ideas on some code I can put in to prevent this. I want the saved form to show exactly as it did when the user closed it.

What javascript is needed to open the form in the same state it was in when it was saved and closed?

In another post, Paul wrote: "You will need to keep track of the state of the form and reset it when it is opened. There was a feature added in version 9 to take care of this but that means all users have to use version 9 of Acrobat/Reader." What is that feature? And it's in Reader, correct?

4 Replies
Niall_O_Donovan
Level 10
Level 10

Hi Graham,

I don't have LC open, but in the File / Form Properties /Defaults  there is a radio button for automatically preserving / saving script changes. Tick Auto. If that doesn't work for you, try duplicating the script in the docReady event (fires once when the form is opened) and will look at the value of the radio button and take appropriate action. Not the nicest, but best I can do with the grey cells.

Niall

PS alternatively in the docReady event have the following script referencing  where the main script in the radio button is located.

this.execEvent("exit"); 
Graham_Calhoun
Level 4
Level 4

Niall,

Thanks for the speedy reply. The automatic button certainly is enticing, but the language to the right of it, "Script-based state changes are saved locally in an insecure fashion. This option cannot be used for certified forms." looks mighty perilous. I am concerned about the intellectual property invested in this form. Does this pose a threat to preserving my hard work?

I will have a peek at doing the alternative.

Thanks,

Graham

Niall_O_Donovan
Level 10
Level 10

Hi Graham,

I don't think you should be too alarmed. We ave certified forms and to do so you have to have the choice set to manual. To be honest the security relates to the integrity of the data (I think). Unless the data / form are highly confidential, I would stick with "auto".

Password protecting the form in properties / PDF security will protect your hard work. You can set it up that the form opens without asking for a password in Acrobat, but if someone opens it in LC then they will need the password.

Niall