• 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 "No" button not working properly

Community Beginner ,
Jun 19, 2022 Jun 19, 2022

Copy link to clipboard

Copied

what do I have to change in the script to make the no option of the clear form button I created not reset all of the checkboxes to transparent backgrounds. It currently keeps the data though.

 

var x = app.alert("Are you sure you want to clear this document and reset all fillable form fields?", 2, 2);
if(x == 4)
this.resetForm();
for (var i = 0; i < this.numFields; i++) { var oFld = this.getField(this.getNthFieldName(i)); oFld.fillColor = color.transparent; }
event.target.fillColor = ["RGB", 255/255, 255/255, 204/255];
var f = this.getField("Footer Copywrite");
if (f.valueAsString=="") f.value = util.printd("©yyyy", new Date());

TOPICS
JavaScript , PDF forms

Views

200

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 , Jun 19, 2022 Jun 19, 2022

Insert red part in your script:

var oFld = this.getField(this.getNthFieldName(i));
if(oFld.type == "checkbox" && oFld.valueAsString != "Off"){
continue;}
oFld.fillColor = color.transparent; }

 

It won't reset checkbox if it's checked.

Votes

Translate

Translate
Community Expert ,
Jun 19, 2022 Jun 19, 2022

Copy link to clipboard

Copied

Insert red part in your script:

var oFld = this.getField(this.getNthFieldName(i));
if(oFld.type == "checkbox" && oFld.valueAsString != "Off"){
continue;}
oFld.fillColor = color.transparent; }

 

It won't reset checkbox if it's checked.

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 Beginner ,
Jun 26, 2022 Jun 26, 2022

Copy link to clipboard

Copied

LATEST

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