Copy link to clipboard
Copied
I have a fillable PDF form with a button labeled "EXIT." When that button is pressed, I want to clear the form, close the file, and NOT attempt to save the file. I'm close to making this work, but I get 2 messages/prompts that I'd like to bypass. The first prompt is "Since one of the action results in closing a doc, the rest of the action will not be executed. Do you want to continue?" I always answer "Yes," so I'd like to skip this step. Next, I'm asked "Do you want to save changes to ... before closing?" Again, I always answer "Yes" and want to skip this step. I'm pretty sure the Javascript would help me, but I'm a novice. I think I just need the code to enter into my EXIT button steps.
Copy link to clipboard
Copied
Slight typo... When I Exit, I always answer "No" to saving the file and want to skip that step/question when the EXIT button is pressed.
Copy link to clipboard
Copied
What script does you use?
Copy link to clipboard
Copied
All you need is this command:
this.closeDoc(true);
There's no point in clearing the form since you're not saving the file... The above command will just close the file without saving it. What is saved will remain. What is not saved will be lost.
If you want to make sure the file is cleared then you need to:
- Clear the form
- Save the file
- Close the file
The second step will require a privileged context, though, such as a folder-level script.
Copy link to clipboard
Copied
Thank you. This was very helpful. Is there any javascript that will bypass/prevent the "Since one of the action results in closing a doc, the rest of the action will not be executed. Do you want to continue?" I always answer "OK," so it would save a step if this response could be generetd automatically.
Copy link to clipboard
Copied
What actions does you use at the button?
Copy link to clipboard
Copied
The actions are:
Reset a Form
Run a Javascript [this.dirty=false; this.closeDoc(true) ]
Execute Menu Item (File>Exit Application)
Copy link to clipboard
Copied
You need to do it all in a single script to avoid that, but that last command won't work.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more