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

signauture must not be writable until fields are filled in

New Here ,
Feb 03, 2024 Feb 03, 2024

Copy link to clipboard

Copied

Hello everyone, I have the following problem.
The signature field may only be writable when text1 and checkbox1 are filled in. If not, the message should appear which text/boxes are not yet filled in. Only then can the e-signature be set. I have found this code. The message appears, but it can be confirmed with ok and it is still possible to set the signature. In addition, all required fields are queried. However, only text1 and checkbox1 are to be queried as to whether they are filled. Can someone please help me? Thank you very much.

 

this.getField("Signature").readonly = !validateRequiredFields(this);

 

function validateRequiredFields(doc) {

var emptyFields = [];

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

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

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

emptyFields.push(f.name);

}

}

 

if (emptyFields.length>0) {

app.alert("Bitte noch folgende felder ausfüllen:\n" + emptyFields.join("\n"));

return false;

}

return true;

}

 

TOPICS
Acrobat SDK and JavaScript

Views

87

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 Expert ,
Feb 10, 2024 Feb 10, 2024

Copy link to clipboard

Copied

LATEST

Hi,

 

I have not checked the code, but what if you made the field hidden and then show it when the fields are filled in, you could hide it again if they are changed to be blank, this would mean that the user cannot sign the document until they have done what you required.

 

I would recommend moving the script to the validate event of the fields that you are wanting to be filled in.

 

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