How to use signatures to automatically check off a specific box (checklist)

New Here ,
Aug 19, 2019 Aug 19, 2019

Copy link to clipboard

Copied

Hello!

I want to start off by saying that I have limited to no experience directly with JavaScript, but do have basic programming knowledge of VBA and Java.

I am working on automation within an on-boarding document for new employees where the only requirements are:

a) When a signature field is signed off on, mark off a check box in the document;

b) Display "Not Complete" if all check boxes have not been checked off from a signature;

c) Display "Complete" if all check boxes have been checked off;

d) If possible, prevent document from being submitted via e-mail until the document is marked as complete.

Any help is appreciated. Even getting task "a" working is huge progress!

Thanks,

Jeff

TOPICS
Acrobat SDK and JavaScript, Windows

Views

51

Likes

translate

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
Most Valuable Participant ,
Aug 19, 2019 Aug 19, 2019

Copy link to clipboard

Copied

You can do all of this using a script as the Signed action of the signature field.

Regarding b and c, though, do you want it to validate all the check-boxes in the file, or just some?

Likes

translate

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
New Here ,
Aug 19, 2019 Aug 19, 2019

Copy link to clipboard

Copied

Hi try67,

Thank you very much for your reply!

I figured so, but i'm having difficulty finding any sample coding or documentation to get me started.

It will be select check boxes, but not all the ones found in the document. Its 35 documents built into one package.

Thanks,

Jeff

Likes

translate

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
Most Valuable Participant ,
Aug 19, 2019 Aug 19, 2019

Copy link to clipboard

Copied

OK, I'll help you with the code, but what's the name of the check-box field in A and the text field in B & C?

Likes

translate

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
New Here ,
Aug 19, 2019 Aug 19, 2019

Copy link to clipboard

Copied

Wow that's amazing thank you!

A = check1

B = status1

Thanks,

Jeff

Likes

translate

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
Most Valuable Participant ,
Aug 19, 2019 Aug 19, 2019

Copy link to clipboard

Copied

Here's the script to use:

this.getField("check1").checkThisBox(0, true);

var checkboxes = ["", "", ""]; // enter the names of the check-boxes to validate in this array

var allChecked = true;

for (var i in checkboxes) {

    var f = this.getField(checkboxes);

    if (f==null) {app.alert("Error! Can't locate: " + checkboxes); break;}

    if (f.valueAsString=="Off") {allChecked = false; break;}

}

this.getField("status1").value = allChecked ? "Complete" : "Not Complete";

To achieve "D" you should set the default value of "status1" as "Not Complete" and define it as a required field.

Likes

translate

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
New Here ,
Aug 19, 2019 Aug 19, 2019

Copy link to clipboard

Copied

Hey try67,

That code definitely achieved tasks B + C! It turns out I was editing the document in some sort of e-signature mode where I couldn't set actions on any fields. I started from scratch again with your code and had no problems applying it.

If I wanted to use something similar that I apply to every check box to check if a signature field has been entered, what could I use?

Thanks,

Jeff

Likes

translate

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
Most Valuable Participant ,
Aug 19, 2019 Aug 19, 2019

Copy link to clipboard

Copied

That's a common issue. To fix it do this:

Click on Tools - Prepare Form and then click on "More" at the right side of the window and then on "Revert to Acrobat Form".

I didn't quite understand your last question. You want to validate all check-boxes, instead of just some?

Likes

translate

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