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

Clear form when I open a PDF

Explorer ,
Jul 30, 2019 Jul 30, 2019

Copy link to clipboard

Copied

Hi everybody, is it possible to clear the fields of a form when I open a PDF document? How? Is it possible in Adobe Javascript?

​Regards

Views

5.3K

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
Adobe Employee ,
Jul 30, 2019 Jul 30, 2019

Copy link to clipboard

Copied

Acrobat DC SDK Documentation

resetForm

3.01

https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/Acro12_MasterBook/JS_API_AcroJSPre...D

https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/Acro12_MasterBook/JS_API_AcroJSPre...F

Resets the field values within a document. Resetting a field causes it to take on its default value (which, in the case of text fields, is usually blank).

Note:If the form contains signature fields, signature rights https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/Acro12_MasterBook/JS_API_AcroJSPre...are required to use the method in Adobe Reader.

Parameters

aFields

(optional) An array specifying the fields to reset. If not present or null, all fields in the form are reset. You can include non-terminal fields in the array.

Example 1

Select fields to be reset and reset them.

   var fields = new Array();

   fields[0] = "P1.OrderForm.Description";

   fields[1] = "P1.OrderForm.Qty";

   this.resetForm(fields);

The same fields can be reset using only one line of code:

   this.resetForm(["P1.OrderForm.Description","P1.OrderForm.Qty"]);

Example 2

This example shows how to reset a whole subtree. For example, if you pass “name” as part of the fields array, all name fields, such as name.first and name.last, are reset.

   this.resetForm(["name"]);

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
New Here ,
Nov 16, 2023 Nov 16, 2023

Copy link to clipboard

Copied

LATEST

Thanks, at Document level, below works if you are just wanting to reset one form field on open. Omitting the subtree brackets [ ]

this.resetForm("fieldname"); 

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 ,
Jul 30, 2019 Jul 30, 2019

Copy link to clipboard

Copied

Yes, it's possible to do that with a simple script, but you can't apply such a script with the free Reader. Do you have Acrobat? If so, which version?

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 ,
Jul 30, 2019 Jul 30, 2019

Copy link to clipboard

Copied

Juanki  wrote

is it possible to clear the fields of a form when I open a PDF document?

Hi Juan,

You don't need to write JavaScript, but you do need Acrobat, not the free Reader. Set a Page Property for Page 1 (or whatever page the PDF opens to) in either the Page Thumbnails panel or Organize Pages.

Trigger: Page Open

Action: Reset a form

~ Jane

Here are the plans and pricing. If you don't want the annual plan, paid monthly, you can get a monthly plan for $25. There is also a seven-day free trial.

Plans and pricing | Adobe Acrobat DC

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 ,
Jul 31, 2019 Jul 31, 2019

Copy link to clipboard

Copied

That will reset the form each time you open page 1, not just when you open the file, though... For example, if you fill in some data, scroll to page 2 and then back to page 1, that data will be gone.

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
New Here ,
Aug 21, 2022 Aug 21, 2022

Copy link to clipboard

Copied

Hi, I agree with the @try67 , it resets the form every time I move between pages. What is the best way to clear the form.  Thank You

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 ,
Aug 21, 2022 Aug 21, 2022

Copy link to clipboard

Copied

Reset the form at document open.

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 ,
Jul 31, 2019 Jul 31, 2019

Copy link to clipboard

Copied

It works jane-e​!!

Thanks and regards

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 ,
Jul 31, 2019 Jul 31, 2019

Copy link to clipboard

Copied

Juanki  wrote

It works jane-e !!

Thanks and regards

Hi

Although it appears to work, try67 is correct — it does not work. If it is a multiple page form, then returning to Page 1 will trigger the Clear Form command. Please mark his answer correct instead.

~ Jane

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