Skip to main content
Known Participant
Jul 30, 2019 10:40 AM UTC
Question

Clear form when I open a PDF

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

    This topic is closed to new replies. Start a new post to keep the conversation going.

    9 replies

    jane-e
    Community Expert
    Community Expert
    Jul 31, 2019 1:15 AM UTC

    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

    Translate
    try67
    Community Expert
    Community Expert
    Jul 31, 2019 7:39 AM UTC

    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.

    Translate
    Participant
    Aug 21, 2022 12:04 PM UTC

    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

    Translate
    try67
    Community Expert
    Community Expert
    Jul 30, 2019 9:38 PM UTC

    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?

    Translate
    Adobe Employee
    Jul 30, 2019 5:36 PM UTC

    Acrobat DC SDK Documentation

    resetForm

    3.01

    https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/Acro12_MasterBook/JS_API_AcroJSPreface/Quick_bars.htm#HT_dirtyD

    https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/Acro12_MasterBook/JS_API_AcroJSPreface/Quick_bars.htm#HT_Column4F

    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_AcroJSPreface/Quick_bars.htm#HT_Column4are 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"]);

    Translate
    Participant
    Nov 17, 2023 2:43 AM UTC

    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"); 

    Translate