Skip to main content
Participating Frequently
June 14, 2016
Answered

Date autofill with signature

  • June 14, 2016
  • 1 reply
  • 3076 views

I created a form with adobe that requires digital signatures from at least 3 people. Everything is fine until my auto fill script dates the signature. For some reason all the signatures will be dated to match the most recent signature. Here is my script:

Signature field 1:

var a = this.getField("PROVIDER SIGNATURE").value;

if( a > "0") {event.value = util.printd("yyyymmdd", new Date())} else {event.value = ""}

Signature field 2:

var b = this.getField("FLIGHT SURGEON SIGNATURE").value;

if( b > "0") {event.value = util.printd("yyyymmdd", new Date())} else {event.value = null}

Signature field 3:

var c = this.getField("MEMBER SIGNATURE").value;

if( c > "0") {event.value = util.printd("yyyymmdd", new Date())} else {event.value = null}

Signature field 4:

var d = this.getField("COMMANDER SIGNATURE").value;

if( d > "0") {event.value = util.printd("yyyymmdd", new Date())} else {event.value = null}

At least three of the four field have to be signed but if the Provider and the Soldier sign on 20160305 and the Commander signs three days later, it changes the dates for the Provider and Soldiers signatures to the same date as the Commander.

This topic has been closed for replies.
Correct answer try67

Can I do this and still have the signature lock fields? That was why I put it in the date field and not the signature. Once the Provider signs it I need certain fields to become read only so that when it goes to the next person in line for signature they can't manipulate and change what the Doctor said.


Yes, you can still do it by using a script that sets those fields as

read-only, like so:

this.getField("FieldName").readonly = true;

1 reply

try67
Community Expert
Community Expert
June 14, 2016

When comparing numbers do not put double-quotes around them. It converts them to strings and the mathematical operators will not work (correctly) on them.

willkirtAuthor
Participating Frequently
June 14, 2016

If I remove to quotation marks from the "0" it no longer dates the field. The real issue I am having though, because for the most part it works, is that when the form gets sent to the Commander for signature, all the signature date fields that have been signed get redated to match when he signed. I thought that giving each signature block its own variable would fix this because each event would be tied to that event. What appears to be happening, as far as I can tell. the event will happen for any variable that is greater then 0. so any block that is signed will be redated with each new signature. Could I separate the events like event1.value, event2.value, or is there another way?

try67
Community Expert
Community Expert
June 14, 2016

I don't quite understand what you're trying to do, to be honest... When you

sign a digital signature field it will automatically contain the time it

was signed. There's no need to use any script for that.