Copy link to clipboard
Copied
The following code works to add a date in "Date1" field but when I try to clear the same signature, the date still remains.
What am I missing?
if (getField("Signature1").value !== '')// signature is present
this.getField("Date1").value= "";
else
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"); //Modify the field name as necessary
f.value = signingTime;
Copy link to clipboard
Copied
Where does you use the script?
Copy link to clipboard
Copied
In the Digital Signature Properties under the 'signed' tab, 'This script executes when field is signed:'
Copy link to clipboard
Copied
I figured out how to copy the date using this thread:
Solved: Can Acrobat auto populate a date field upon digita... - Adobe Community - 4524073
This works to clear the date using the following code:
if (getField("IT Signature").value !=='')// signature is present
getField("IT Date").value = ''; //blank if signature cleared
How do I change the code so that it will clear when the signature is NOT present?
Copy link to clipboard
Copied
Change:
if (getField("IT Signature").value !=='')
To:
if (getField("IT Signature").value=='')
Copy link to clipboard
Copied
Dang. That doesn't work. It doesn't clear the date field upon clearing the signature. It only clears it if you click the signature field again after you clear it (then hit cancel).
Copy link to clipboard
Copied
Were you able to figure it out?
I'm trying to reformat a document and they want the date field to clear along with the signature.
I'm still fairly inexperienced with javascript so anything I can mess around with will help
Copy link to clipboard
Copied
Digital signatures fields already show the date when you sign them, and it is removed when you clear them.
Why re-invent the wheel?
Copy link to clipboard
Copied
I agree but the people wanting me to do this think the date is too small and they want something more obvious.
Copy link to clipboard
Copied
Well, you can't really do that, as clearing a signature does not trigger any events. You could use a script at doc-load or save to clear the date field if the signature field is empty, though.
Copy link to clipboard
Copied
After signing a document, it should not be possible to modify that document. That's against the essence of a signature.
Copy link to clipboard
Copied
That's not entirely true. Form fields can remain editable, unless the signature is set to lock them.
However, the signature will not be valid if you edit them, as the file has been changed.
Other signatures can also be applied, and that should keep the original signature valid.
Copy link to clipboard
Copied
Yes sir. I have that field marked as read only so it cannot be edited.
The only thing I have to do is clear it once the signature is cleared. I have looked everywhere and other posts claim to have it worked but I haven't been able to.
Copy link to clipboard
Copied
I figured out how to copy the date using this thread:
Solved: Can Acrobat auto populate a date field upon digita... - Adobe Community - 4524073
This works to clear the date using the following code:
if (getField("IT Signature").value !=='')// signature is present
getField("IT Date").value = ''; //blank if signature cleared
How do I change the code so that it will clear when the signature is NOT present?
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more