Copy link to clipboard
Copied
I am using Acrobat Pro 2020. I have a document that needs to set as read-only (lock? it needs to make the fields un-editable) all of it's fields except a second signature field once the first signature field is signed. I was using the built-in functionality to "Mark as read-only: All fields except these" and then listing the second signature field. This method was working fine but now I must add a drop down field ("DD1") that once an item is selected, it auto-populates two other drop-down fields ("DD2" and "DD3"). What I would like to happen is when the first signature field is signed, all of the fields except the second signature block become read-only, and the first drop-down field ("DD1") becomes hidden. The PDF is never actaully printed, it's only used digitally, so that's why using the field property "Form Field: Visible/Hidden/Visible but doesn't print/Hidden but printable" won't suffice.
From my understanding, I have to use a script that marks the fields as read-only and sets "DD1" to hidden because I can only select one option for what happens when the first signature field is signed. Any help with figuring a script like that out would be really helpful!!
Copy link to clipboard
Copied
Yes, you will need to use a script to do it, and while it can't actually lock the fields, it can set them as read-only.
You can use the following code for that:
this.getField("DD1").display = display.hidden;
for (var i=0; i<this.numFields; i++) {
var fname = this.getNthFieldName(i);
var f = this.getField(fname);
if (f==null) continue;
if (f.name=="Signature2") continue; // Do not "lock" the other signature field
f.readonly = true;
}
Copy link to clipboard
Copied
Yes, you will need to use a script to do it, and while it can't actually lock the fields, it can set them as read-only.
You can use the following code for that:
this.getField("DD1").display = display.hidden;
for (var i=0; i<this.numFields; i++) {
var fname = this.getNthFieldName(i);
var f = this.getField(fname);
if (f==null) continue;
if (f.name=="Signature2") continue; // Do not "lock" the other signature field
f.readonly = true;
}
Copy link to clipboard
Copied
This worked PERFECTLY. Thank you so much. I spent so much time trying to jerry-rig a script to try and do what I wanted.
Copy link to clipboard
Copied
Can you tell me where I put the code? I've never done it before and think is a solution i need for my file. TIA
Copy link to clipboard
Copied
Under the Signed event of the first signature field:

