Acrobat Pro DC Running JavaScript
I am running JavaScript in my Acrobat Doc to validate and flatten all the entered fields and attach the pdf file to an email. Everything works perfectly.
I added a field for signature and the button does not work then the form is signed. I am not sure if the signature disables the button or prevents JavaScript from running. I would really appreciate any help. Thank you.
Here is my code.
var success = 0;
var validEntries = false;
for (var i = 0; i < requiredFields.length; i++) {
var fieldName = requiredFields;
var field = this.getField(fieldName);
if (isFilled(field.value)) {
success ++;
} else {
app.alert("Please enter the selected required field.");
field.setFocus();
break;
}
}
if (success == requiredFields.length) {
for (var i = a_and_l_services.length - 1; i >= 0; i--) {
if (this.getField(a_and_l_services).value == "On") {
validEntries = true;
break;
}
}
}
if (validEntries) {
disable();
var toAddr = this.getField(someField).value;
var toCC = "email@example.com";
var subject = this.getField(field1).value + " - " + this.getField(field2).value + " - Review Required - Architecture and Launch";
var message = "Exception Review Required - Architecture and Launch Services. The attached file is the filled-out form. Please open it to review the data.";
this.mailDoc({bUI: true, cTo: toAddr, cCc: toCC, cSubject: subject, cMsg: message});
}
function isFilled(str) {
return str != "" && str != "nil" && str.length != 0;
}
function disable() {
for (var i = allFields.length - 1; i >= 0; i--) {
var field = this.getField(allFields);
field.readonly = true;
field.fillColor = ["G", 0.75];
field.borderColor = ["G", 2/3];
field.textColorr = ["G", 0.5];
}
}
