Skip to main content
Participant
January 25, 2022
Question

Exiting Fillable PDF Without Saving Form

  • January 25, 2022
  • 3 replies
  • 1905 views

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. 

This topic has been closed for replies.

3 replies

try67
Community Expert
Community Expert
January 25, 2022

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.

Participant
January 25, 2022

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.

Bernd Alheit
Community Expert
Community Expert
January 25, 2022

What actions does you use at the button?

Bernd Alheit
Community Expert
Community Expert
January 25, 2022

What script does you use?

Participant
January 25, 2022

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.