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

show dialog only once.

pessi
Registered: Mar 10 2010
Posts: 11
Answered

Hi,

I have javascript to show a dialog..
What I need is that the dialog should be shown only once on document opening..
When the user closes the document and opens it again I donot want to show the dialog again..

To solve this issue, I thought of the following..maybe I headed in an entirely wrong direction?

I made a textfield and set the value to "yes".
Before showing the dialog..I check if this value is "Yes" then show dialog else dont show.
After showing the dialog..I set the value to "no"

However, after setting the value of the field programatically, there is a prompt to save the file..

Is there a workaround?

Thanks a lot in advance,
Prasad.

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
No, since you changed a field the form will need to be saved before the value will be retained.

George Kaiser

pessi
Registered: Mar 10 2010
Posts: 11
Thank you for your answer.
Is there any other way to show a dialog only once and then disable it?
jimhealy
Team
Registered: Jan 2 2006
Posts: 146
Use the global object:
global.myDialogWasShown = true;global.setPersistent("myDialogWasShown", true);

Jim Healy
FormRouter, Inc.
Check out our FREE Advanced Acroform Toolset:
http://www.formrouter.com/tools

Jim Healy, Founder & CEO FormRouter Inc.
Chapter Leader AUG RTP NC
http://www.formrouter.com

pessi
Registered: Mar 10 2010
Posts: 11
Jim

Thank you for the Wonderful Solution.
For more information on how I solved it.

I made what Jim stated, to set the global.myvariable to true when the ok button is clicked.

However, as I am automating the process of generating the javascript (in my software) and then embedding the javascript in the pdf (chosen in the software) I ran into another problem.

1. If the software is used to generate A.pdf
and then
2. B.pdf

disabling the dialog after first click in A.pdf will also disable it in B.pdf.

I solved it by generating a random variable name (also will avoid conflicts) and appending it to "global." + myrandomstring
this way..every time someone uses the software..a new variable is being generated and checked for.

The only downside being..if the software is used multiple times on a same pdf...then it will lead to a redundant global variable every time...I hope this is not an issue?

Thank you so much for the help and a quick solution.

Prasad.