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

how to reset form fields after closing form

Explorer ,
Apr 19, 2018 Apr 19, 2018

Copy link to clipboard

Copied

I'm trying to create a form that resets if's fields to blank when it is closed.

I'm using the following actions

MouseUp

  • Submit a form
  • Reset a form

Execute menu item

  • file close

After the file is closed I reopen it and find that what was filled in the form still remains and it was not reset to blank.

I have also tried the following Java commands

  • this.dirty = false
  • this.closeDoc(true)

please help if you can.

TOPICS
PDF forms

Views

4.9K

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Apr 19, 2018 Apr 19, 2018

Use this code to reset the entire form:

this.resetForm();

Votes

Translate

Translate
Community Expert ,
Apr 19, 2018 Apr 19, 2018

Copy link to clipboard

Copied

Why do you want to do that? That is very frustrating for anyone using it...

Votes

Translate

Translate

Report

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
Explorer ,
Apr 19, 2018 Apr 19, 2018

Copy link to clipboard

Copied

The form in question is an expense submission sheet for our mobile employees to fill in and submit, we don't want information remaining in the form for the next person to see, the form needs to be reset to blank for the next employee to submit there expenses.

As it stands right now when the form is exited out (without saving) and reopened you see the last persons expense information in it.

Votes

Translate

Translate

Report

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 ,
Apr 19, 2018 Apr 19, 2018

Copy link to clipboard

Copied

Move the code to a doc-level script, so that it executes when the file is opened, instead.

Votes

Translate

Translate

Report

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
Explorer ,
Apr 19, 2018 Apr 19, 2018

Copy link to clipboard

Copied

OK I just did a quick search on setting up doc-level scripts for Adobe Acrobat DC and I just want to confirm are you referring to the Action to Run JavaScript's under the button properties?

Votes

Translate

Translate

Report

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
Explorer ,
Apr 19, 2018 Apr 19, 2018

Copy link to clipboard

Copied

Ok I found what you are talking about now.

Now I have to find some script that will work with the document.

Votes

Translate

Translate

Report

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 ,
Apr 19, 2018 Apr 19, 2018

Copy link to clipboard

Copied

Use this code to reset the entire form:

this.resetForm();

Votes

Translate

Translate

Report

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
Explorer ,
Apr 19, 2018 Apr 19, 2018

Copy link to clipboard

Copied

That worked!

But I'm running into one more issue in the process is there any way to suppress the prompt to save the document when closing so we don't overwrite the existing document or save more than one copy?

Votes

Translate

Translate

Report

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 ,
Apr 19, 2018 Apr 19, 2018

Copy link to clipboard

Copied

Yeah, there is. Go to Tools - JavaScript - Set Document Actions and under the "Document Will Close" event enter this code:

this.dirty=false;

Votes

Translate

Translate

Report

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
Explorer ,
Apr 20, 2018 Apr 20, 2018

Copy link to clipboard

Copied

LATEST

Thanks

It now closes without asking to save.

Votes

Translate

Translate

Report

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