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

Bottom to print only required visible fields in PDF Acrobat Form

New Here ,
Oct 01, 2019 Oct 01, 2019

Copy link to clipboard

Copied

 

Hello, I have a problem with print bottom that I need to solve urgently.

I have a complex form that shows / hides a series of fields according to a check box: company or person client.

After completing the form I need the print button to validate required fields but only visible fields: hidden required fields should not be validated before printing.

Someone help me?

Bellow Javascript the code that I used in the print button (this code validates all fields, but I need validate only visible fields)

I read this answer with a code snippet but couldn't embed it in my code correctly: Acrobat Users: 

equired fields only required when visible and when hidden not required?

 

 

var emptyFields = [];

for (var i=0; i<this.numFields; i++) {

     var f= this.getField(this.getNthFieldName(i));

     if (f.type!="button" && f.required ) {

          if ((f.type=="text" && f.value=="") || (f.type=="checkbox" && f.value=="Off")) emptyFields.push(f.name);

     }
}
if (emptyFields.length>0) {

     app.alert("Alerta! Voce precisa preencher os campos obrigatórios:\n" + emptyFields.join("\n"));
}
else{
this.print();
}

 

 

 

Fabiana GO

Views

403

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
LEGEND ,
Oct 01, 2019 Oct 01, 2019

Copy link to clipboard

Copied

LATEST

You are not testing for the visible type of fields.

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