Copy link to clipboard
Copied
Hoping someone can help me with a specific requirement I have. I have included an action button in my pdf to make certain fields in my form read only. I have written the javascript code for it and it works perfectly. I need to include a second action button that would reverse the 'read-only' fields back to being eidtable but this second button should be executed only on a successful password entry. Can someone please help with the javascript code that is required for this second button?
Thank you!
Try this script (don't forget to set the password and the name of the field to be unlocked):
var cResponse = app.response({cQuestion: "Enter password", cTitle: "PASSWORD", });
{
// Cancel
if (cResponse == null) {app.alert({cMsg: "You must enter your password to unlock this field.", cTitle: "PASSWORD", nIcon: 3});}
// password OK
else if (cResponse == "123456") {this.getField("lockedField").readonly = false;}
// password KO
else {app.alert({cMsg: "Invalid password.", cTitle: "PASSWORD", nIcon: 0});}
}
Copy link to clipboard
Copied
Try this script (don't forget to set the password and the name of the field to be unlocked):
var cResponse = app.response({cQuestion: "Enter password", cTitle: "PASSWORD", });
{
// Cancel
if (cResponse == null) {app.alert({cMsg: "You must enter your password to unlock this field.", cTitle: "PASSWORD", nIcon: 3});}
// password OK
else if (cResponse == "123456") {this.getField("lockedField").readonly = false;}
// password KO
else {app.alert({cMsg: "Invalid password.", cTitle: "PASSWORD", nIcon: 0});}
}
Copy link to clipboard
Copied
@JR Boulay Thank you! It worked perfectly! 🙂
Copy link to clipboard
Copied
Keep in mind that this is a very low security level since the password is stored in the script.