Acrobat Script to require Multiple Check Boxes To Be Checked Before Allowing Digital Signature

Greetings,

I have a form with 3 checkboxes within the form and I’m trying to write a script that requires all 3 to be checked before the form can be digitally signed. This is what I put in the action tab of my digital signature field but keep getting an error.

if this.getField(“Quarantine Exempt Certification-cb”).value !==“Yes” ||
this.getField(“Click to sign-cb”).value !==“Yes” ||
this.getField(“Emergency Leave Certification-cb”).value !==“Yes”;
this.getField(“Employee Signature Field”).readOnly = (event.target.value == “Off”);

I will appreciate all the help I may receive.

There are problems with how you are structuring the if condition.

Let’s move each of those conditions out to separate variables, to help remove mistakes from the structure of the if statement.

var qec = this.getField("Quarantine Exempt Certification-cb").value === "Yes";
var sign = this.getField("Click to sign-cb").value === "Yes";
var elc = this.getField("Emergency Leave Certification-cb").value === "Yes";
if (!qec || !sign || !elc) {
    var isOff = event.target.value === "Off";
    this.getField("Employee Signature Field").readOnly = isOff;
}

Sir, thanks for your assistance. I tried the code and intentionally did not check one of the checkboxes and it allowed me to digitally sign. How can I prevent this?

None of that code examines whether a checkbox is checked. Checkboxes all retain their value, regardless of whether they are checked or not.

I’ll run up a working code example that should simulate what you are wanting to achieve.

Oh I thought if I checked the “Required” box in the checkbox common properties would handle that.

You have checkbox common properties? What are you using to develop it? Is it C#, or Acrobat, or is it something else?

I’m using Acrobat

1 Like

Thanks. I don’t think that we’ve ever had someone here with Acrobat. You might not find anyone here that can help you.

I recommend that you head over to the Adobe forum to gain some help with what you need.

Ok thanks. You have been a really big help.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.