Copy link to clipboard
Copied
I'm creating a form in Acrobat Pro from an existing PDF using the Prepare Form feature. I need a signature in one of two places. One place is to sign if the signer is 18+. There is a separate place for the signature if signing for a minor. I can only see how to require a signature in both places. How do I request the signature for either or?
Copy link to clipboard
Copied
Do you have an age field, or DOB, or something like that?
Copy link to clipboard
Copied
Yes there is.
Copy link to clipboard
Copied
OK... Which one?
Copy link to clipboard
Copied
DOB text field
Copy link to clipboard
Copied
You can use this code as that field's custom Validation script, then (adjust the date format pattern and the names of the signature fields, as needed):
if (event.value) {
var age = calcAge(event.value, "mm/dd/yyyy");
this.getField("SignatureMinor").required = (age<18);
this.getField("SignatureAdult").required = (age>=18);
} else {
this.getField("SignatureMinor").required = false;
this.getField("SignatureAdult").required = false;
}
function calcAge(dobValue, dateFormat) {
var dob = util.scand(dateFormat, dobValue);
var now = new Date();
var age = now.getFullYear() - dob.getFullYear();
if (now.getMonth() < dob.getMonth()) {
age--;
} else if (now.getMonth()==dob.getMonth() && now.getDate() < dob.getDate()) {
age--;
}
return age;
}
Copy link to clipboard
Copied
You are amazing. Thanks for your help! I knew there had to be a way.