Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Exiting Fillable PDF Without Saving Form

New Here ,
Jan 24, 2022 Jan 24, 2022

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. 

TOPICS
JavaScript , PDF forms
2.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 24, 2022 Jan 24, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 24, 2022 Jan 24, 2022

What script does you use?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 25, 2022 Jan 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 25, 2022 Jan 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 25, 2022 Jan 25, 2022

What actions does you use at the button?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 25, 2022 Jan 25, 2022

The actions are:

Reset a Form

Run a Javascript [this.dirty=false;  this.closeDoc(true) ]

Execute Menu Item  (File>Exit Application)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 25, 2022 Jan 25, 2022
LATEST

You need to do it all in a single script to avoid that, but that last command won't work.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines