Copy link to clipboard
Copied
Hi there,
I wish to know the extension of the Javasript to make an entire PDF read only Except one button. I currently have the coding that will make the whole document 'read only' however I Wish to have an exception for the 'submit' button.
Please let me know what the code extension to the below is:
for (var i = 0; i < this.numFields; i++) {
var fname = this.getNthFieldName(i);
this.getField(fname).readonly = true; // makes all fields readonly
}
Copy link to clipboard
Copied
Try this:
for (var i = 0; i < this.numFields; i++) {
var fname = this.getNthFieldName(i);
if (fname !== "NameOfButtonToExclude") {
this.getField(fname).readonly = true; // makes all fields readonly
}
}
but replace "NameOfButtonToExclude" with the actual name of the button you want to exclude.
Copy link to clipboard
Copied
Hi.
You don't need an exception: just lock all fields, then unlock the button.
for (var i = 0; i < this.numFields; i++) {
var fname = this.getNthFieldName(i);
this.getField(fname).readonly = true; // makes all fields readonly
}
this.getField(MYBUTTON).readonly = false;
Find more inspiration, events, and resources on the new Adobe Community
Explore Now