Skip to main content
Blueprint-Pre-Press
Participating Frequently
December 18, 2019
Resuelto

Can Acrobat auto populate a Name field upon digital signature of a form?

  • December 18, 2019
  • 2 respuestas
  • 8591 visualizaciones

I know you can auto populate a Date Field upon Digital Signature from a form but I'd also like to auto populate a Name Field. I am making a form which requires a Digital Signature for approval, along with the client's Name and Date of Approval. I have added the required Java script to generate the Date but I was wondering is there a way to generate the Name based on the name information from the digital signature?

Este tema ha sido cerrado para respuestas.
Mejor respuesta de ls_rbls

Extracting from ls_rbls - this is what worked perfectly for me.
When signed, the document fills out a date stamp next to it automatically.


Insert Text Box next to Signature > Right-click the Text Box > Properties > mark Read Only and close.


Script: Right-click the Signature > Properties > Signed > Edit > Paste the following:

var f = event.target;

var sigInfo = f.signatureInfo();

this.getField("Text34").value = util.printd("yyyymmdd", new Date((util.scand("ddd mmm dd yyyy HH:MM:ss ZZ", sigInfo.date ))));

if (f.signatureValidate()==4);

 

... but ... Hahah.

 

If I remove the signature, how do I delete the data without changing the box to NOT be Read-Only.


Great!

 

And thank you for sharing this.

 

To clear the contents of the date field when the signature field is cleared, you may use a custom validation script or custom calculation script executed directly from the date field.

 

Something like this:

 

 

if(this.getField("mySignatureField").value == "") event.value = "";

 

 

OR,

 

You may also add a Mouse Exit event to the signature field:

 

 

if(event.target.value =="") this.getField("Text34").value = "";

}

 

 

With the latter script, when the signature field is cleared and the mouse pointer is moved outside of that field it will set the date field to a blank value.

 

2 respuestas

try67
Community Expert
Community Expert
December 28, 2019

You can use this code to do it (as the Signed script of your signature field):

 

var f = event.target;
if (f.signatureValidate()==4) {
	var Info = f.signatureInfo();
	this.getField("SigName").value = "Signed by: " + Info.name;
	this.getField("SigDate").value = "Signed on: " + Info.date;
} else {
	this.getField("SigName").value = "";
	this.getField("SigDate").value = "";
}
ls_rbls
Community Expert
Community Expert
December 28, 2019

Thank you so much!!

 

I've spent literally 8 to 12 months trying to figure this out.

 

 

 

 

try67
Community Expert
Community Expert
December 28, 2019

You're very welcome!

ls_rbls
Community Expert
Community Expert
December 18, 2019

Hi,

 

I've been trying to work on similar with  a PDF form of my own.

 

I've recently came accross this possible solution but I haven't tested it on my end:

 

https://experienceleaguecommunities.adobe.com/t5/Adobe-LiveCycle-Questions/Create-digital-initials-after-signing-a-form-using-a-signature/qaq-p/158630 

 

 

This is an old thread for the date , there is a very short script that works for me for the date part:

 

https://community.adobe.com/t5/acrobat/can-acrobat-auto-populate-a-date-field-upon-digital-signature-of-a-form/td-p/4524073 

 

 

Si when you say digital signature I assume you're referring to electronic signature in the context of digital certificates by which certificate validation and encryption are involved.

 

You may also need to dig deeper on how to use signatureInfo part in your script to get first, middle, last names appropriately from  such digital certificate signatures.

 

 

Blueprint-Pre-Press
Participating Frequently
December 19, 2019

Just to clarify, I already have this script in the: Digital Signature Properties > Signed > This script executes when field is 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_af_date"); //Modify the field name as necessary f.value = signingTime;

Which propagates the correct date in the Date Approved filed of my form when the Signature is actioned. There's also a Approved By field where the user enters their Name. I was hoping the name supplied in the digital signature could be used here but I have no idea what script to use. And, even if there was a script would it clash with what's already there for the date action?

 

ls_rbls
Community Expert
Community Expert
December 19, 2019

in the first link  that I posted earlier above you can use that one to grab the name.

 

Here is how I would do it:

 

  • To avoid the two scripts clashing you don't need to use the same ApprovedBy field; use two fields instead but make it seemless to the user by marking them as readonly.

 

 

So again, a quick easy solution is to create two read-only text form fields (one that will grab the date from the signature field and the other one to grab the name ).

 

All you have to do is add a custom calculation script in both of those text form fields like:

 

for the date try this:

var grabdate = this.getField("yoursignaturefieldname").valueAsString;

 

if (grabdate=="") event.value ="";

 

or use this other method if you choose to use a datefield where the date will be pulled from the signature field with this other method: https://stackoverflow.com/questions/35232909/how-do-i-trigger-javascript-events-when-a-signature-is-cleared-in-acrobat-11 

 

And for the field that will pull the name portion of the signature field use  the same script  above that I just typed as a reference in the custom calculation script section of that text field:

 

(getField("mySig").value !== '') // signature is present    getField("myDate").value = global.getCurDate(); // custom function for a mm/dd/yyyy date
else    getField("myDate").value = '';

 but change the global ogject  from global.getCurDate to the appropriate

 

global.get object of the API reference