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

how to reset form fields after closing form

Explorer ,
Apr 19, 2018 Apr 19, 2018

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
6.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
1 ACCEPTED SOLUTION
Community Expert ,
Apr 19, 2018 Apr 19, 2018

Use this code to reset the entire form:

this.resetForm();

View solution in original post

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

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

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

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.

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

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

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

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?

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

Ok I found what you are talking about now.

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

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

Use this code to reset the entire form:

this.resetForm();

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

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?

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

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

this.dirty=false;

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

Thanks

It now closes without asking to save.

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