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

Is it possible to use javascript to get to auto populate date AND lock the form?

Community Beginner ,
Apr 22, 2016 Apr 22, 2016

I am using Adobe Pro XI, I have a script that will auto populate the date once digitally signed.  I need to know how to also get the form to lock based on that signature as well.  Looking at the Properties for SIGNED, it appears that I can only choose "lock all fields" or enter a script.  The script I am currently using is:

var currentTime = new Date()

var month = currentTime.getMonth()+1

var day = currentTime.getDate()

var year = currentTime.getFulYear()

var signingTime = month+"/"+day+"/"+year

var f = this.getField("Date");

f.value = signingTime;

This works perfectly for auto-populating the date in another field, but I need to also lock the form.  Is there something I can add to this script to accomplish that?

Thank in advance.

TOPICS
Acrobat SDK and JavaScript , Windows
1.3K
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
LEGEND ,
Apr 22, 2016 Apr 22, 2016

With Acrobat JavaScript it is possible to make each field in the form read only.

But anyone with a little knowledge can undo that.

If you really need to lock down a form or at least detect if the form have been changed apply a digital signature or certify the PDF.

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 Beginner ,
Apr 22, 2016 Apr 22, 2016

thank you for responding, but that doesn't answer my question.  I'm aware of the digital signature capabilities.  I also know the date is stamped on the signature as well.  The issue is the font for the digital signature is so small, some in my department can't read it so they still want a text field that shows he date.  That's why I need to modify or add to the current script  in order to accomplish both the actions: Auto populate the date AND lock the fields all based on the digital signature.

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
LEGEND ,
Apr 22, 2016 Apr 22, 2016

There is a navigational panel for signatures that provides all the information about the signature  There is also the loupe tool that can magnify portions of the PDF.

ViewingSignature.jpg

The signature field properties has an option for selecting all fields, fields to exclude or fields to include. No scripting needed.

SignatureFieldChoice.jpg

The above option is only available at the time the signature field is added.

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 Beginner ,
Apr 22, 2016 Apr 22, 2016

Again, my question still remains to be addressed.  I am not asking for a workaround.  I know that the signature info is available as well as the magnification.  This is a question based on the requirements I have been given.  I need to know, based on the script I provided in the original post, what can be done to lock the form and auto populate the date based on the digital signature. 

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
LEGEND ,
Apr 22, 2016 Apr 22, 2016

There are many actions.

One could use the on focus action to populat the signing date field and then then use the on signing action to select the fields to include, exclude, or all fields as necessary.

If you are having an issue with selecting the fields to include or exclude, high light the field name and press the space  bar.It is the same as using the mouse button.

I would also use the util.printd method to format the date fields since it requires only the display format ant the date object as parameters.

You have not picked up all the fields used in the time stamp for the signature. There is a time zone offset included. The displayed time is the local time for the signer. Inclusion of the time zone allows others to adjust the signing time to their time zone if needed. This woud be needed if the individual viewing the form is in a different time zone within country or around the world.

I would use the JavaScirpt option since some parts of this require JavaScripting and trying to split all the action is very difficult because until the document is signed the action could be canceled and that brings on a lot more work if you split the pieces.

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
LEGEND ,
Apr 23, 2016 Apr 23, 2016
LATEST

On old fashion letters the signature block was 5 at below the last line so that is al most an inch in height. Try making the field larger

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