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

How to clear certain fields in Acrobat

Contributor ,
Jun 20, 2025 Jun 20, 2025

I have created a fillable PDF with several input fields. What I want to happen is to create a functional button that will clear a field located on a certain page.

 

This is the script I used, but I am having a Syntax Error: missing ) after argument list1: at line 2.

 

var alert = app.alert("("This action will clear selected fields on this page.\nDo you want to continue?"",0,2);
if(alert == 4){
this.resetForm("FIELD1");
}

TOPICS
PDF forms
83
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 Beginner ,
Jun 20, 2025 Jun 20, 2025

The syntax error is from the quotation marks in your app.alert line. Try this version instead:

var alert = app.alert("This action will clear selected fields on this page.\nDo you want to continue?", 0, 2);
if (alert == 4) {
    this.resetForm(["FIELD1"]);
}

Make sure the field name is exact. Also, resetForm expects an array of field names, even if it’s just one

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 ,
Jun 20, 2025 Jun 20, 2025
LATEST

It's true about resetForm expecting an array, but it will also work with a string as the input.

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