Copy link to clipboard
Copied
I have set up a "Lock Form Fields" button using custom Javascript off of an older form.
var nButton = app.alert({
cMsg: "Do you want to lock down and save this document?",
cTitle: "Form lockdown",
nIcon: 2, nType: 2});
if ( nButton == 4 ) {
for (var i=0; i<this.numFields; i++) {
var fname = this.getNthFieldName(i);
var f = this.getField(fname);
if (f.type!="button" && f.type!="signature") f.readonly = true;}
app.execMenuItem("SaveAs");
}
Is it possible to add javascript to disable the button once it has been clicked? The forms are locked afterwards, but the button remains and I worry less tech-savvy users will continue to click and save thinking it is not locked. Is there a way to make the button non-clickable after the forms have been locked and the document saved?
Select 'Prepare form' tool -> click on 'More' and select 'Document actions' then select 'Document will save' then click 'Edit' and use this script:
this.getField("Button").readonly = true;
Replace "Button" with yur button field name.
This will make that button field readonly when document is saved.
In that case disregard above approach and just add this line: event.target.readonly = true; to the end of your script before last }
Copy link to clipboard
Copied
Select 'Prepare form' tool -> click on 'More' and select 'Document actions' then select 'Document will save' then click 'Edit' and use this script:
this.getField("Button").readonly = true;
Replace "Button" with yur button field name.
This will make that button field readonly when document is saved.
Copy link to clipboard
Copied
This worked! Is there a way to add to the script that it only applys if it is saved with the button, not if it is saved regularly?
Copy link to clipboard
Copied
In that case disregard above approach and just add this line: event.target.readonly = true; to the end of your script before last }
Copy link to clipboard
Copied
Is it possible to trigger the save as BEFORE the lock occurs? IE - if they click cancel on the save as pop up, it will not lock the form?