Save before signature is applied
I have a PDF form which require signatures at different levels.
When the form is signed at the first level, then previous fields must become read-only.
This can easely be done under properties > Signed, then 'MArk as read-only > select the fields to include/exclude from becomming read only.
My challange however is that I want to populate a date field at the same time. I am therefor using the 3rd option to execute a js script.
I am asked where I want to save the signed form.
Signature is applied and the specified fields are read-only on screen.
When I close the form I am prompted to save any changes.
- If I choose save, all is fine.
- If I choose cancel, then the form has the signature applied, but all fields are editable.
I am thinking that the signature is applied and that bit is saved, but the script is executed after that part and not saved.
I also have a 'mouse-down' script in the signature field which just shows an alert that fields will be looked if signing the form.
I tried to place the script in the mnouse down/up location, but that means, if the user clicks on the signature field, gets the alert and decides not to sign the document (cancels out from the signature), then the fields are locked already.
In short, it there a way to populate the date field and lock the fields when the form is signed and saved.
Current code under Properties > Signed
// JavaScript code to add the date at signing time
var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
var signingTime = day +"/"+month+"/"+year //Modify into your preferred format
var f = this.getField("Date1");
f.value = signingTime;
// Look specific fields when digital signature is applied
this.getField("Date1").readonly = true; // Lock signature date field
this.getField("Check Box1").readonly = true;
this.getField("Facility").readonly = true;
this.getField("Address").readonly = true;
this.getField("Account Name").readonly = true;
this.getField("Bank Name").readonly = true;
this.getField("Bank Branch").readonly = true;
this.getField("Bank BSB").readonly = true;
this.getField("Bank Account Nr").readonly = true;
Many thanks for any suggestions and pointers.
