Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Date autofill with signature

New Here ,
Jun 14, 2016 Jun 14, 2016

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.

TOPICS
Acrobat SDK and JavaScript , Windows
2.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 14, 2016 Jun 14, 2016

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

read-only, like so:

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

Translate
Community Expert ,
Jun 14, 2016 Jun 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 14, 2016 Jun 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 14, 2016 Jun 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 14, 2016 Jun 14, 2016

I understand that but it tiny and difficult for some to see. To make it easier for some of our older staff and the like they want it in its own block so it can be readily identified.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 14, 2016 Jun 14, 2016

OK... Where are you placing this code, though?

Also, why are you using "null" in some lines and an empty string in others?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 14, 2016 Jun 14, 2016

Because i don't know much about Java. I created this by looking up code and piecing things together. It has been a lot of trial and error and I have finally hit a point I can't get passed because I just don't understand enough of the code to know where the issue actually lies.

The script is placed in the custom calculation box in the properties of the date field.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 14, 2016 Jun 14, 2016

OK, I see. I would use a different approach. You see, the calculation script executes each time the value of any field is changed, so you keep updating the values, even when you don't want them to change. Instead, I would use the Signed event of the signature fields themselves to update the text fields. The script there would be pretty simple. Something like:

this.getField("SignatureDate").value = util.printd("yyyymmdd", new Date());

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 14, 2016 Jun 14, 2016

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 14, 2016 Jun 14, 2016

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

read-only, like so:

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 14, 2016 Jun 14, 2016
LATEST

That seems to have done the trick. Thank you.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines