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

Button to review required fields and then make visible Electronic Signature

Explorer ,
Jun 17, 2019 Jun 17, 2019

Copy link to clipboard

Copied

I am trying to use the below java script to identify the blank required fields.  If they are complete, I want the electronic signature field visible,  otherwise stay hidden and display the required fields.  My issue is with the signature display part in bold.

if (requiredFields.value == not null) { 

    this.getField("Requestor Electronic Signature").display = display.hidden; 

    app.alert("Error! You must fill in all required Fields:\n"); 

} else { 

     this.getField("Requestor Electronic Signature").display = display.visible; 

var requiredFields = new Array();

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

{

var fName = this.getNthFieldName(i);

var f = this.getField(fName);

if (f.type!="button" && this.getField(fName).required && (this.getField(fName).value == null || this.getField(fName).value == ''))

{

requiredFields[requiredFields.length] = fName;}}

var error = "Please complete the following fields: \n\n";

for (j=0; j < requiredFields.length; j++)

{

if (requiredFields.value == null)

{

error = error + requiredFields + '\n';

var f2 = this.getField(requiredFields);

f2.setFocus();

}

}

if(requiredFields.length > 0)

app.alert(error);

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

{

    var cFldName = this.getNthFieldName(i);

    var oFld = this.getField(cFldName);

    if(oFld.required && (oFld.defaultValue == oFld.value))

    {

        app.alert("Field " + cFldName + " is empty");

    }

}

TOPICS
Acrobat SDK and JavaScript , Windows

Views

87

Likes

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
no replies

Have something to add?

Join the conversation