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

Auto date fill in

New Here ,
Dec 05, 2017 Dec 05, 2017

Copy link to clipboard

Copied

I have a declared date field in an Acrobat form that I want populated as a default with the current date (though it should also be editable). I put Date() in the Calculate field on the form but that doesn't work. Any ideas?

TOPICS
General troubleshooting

Views

1.1K

Translate

Translate

Report

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 ,
Dec 05, 2017 Dec 05, 2017

Copy link to clipboard

Copied

Do you want this set when the PDF is opened, in all cases? Or is there a situation where is should not change?

Remove the calculation script.

Here is some code that will set the field to the current date when it is opened, but only if the field is blank.

Place this code in a document script and change the field name to your date field, and change the formatting to the date format you want.

var fld = this.getField("MyDate");

if(fld.value = "")

  fld.value = util.printd("dd-mm-yy",new Date());

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

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 ,
Dec 05, 2017 Dec 05, 2017

Copy link to clipboard

Copied

Thanks. I put this script in the Custom calculation script of my date

field, but it didn't work. Now what?

Peter Redwood

On Tue, Dec 5, 2017 at 5:39 PM, Thom Parker <forums_noreply@adobe.com>

Votes

Translate

Translate

Report

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 ,
Dec 05, 2017 Dec 05, 2017

Copy link to clipboard

Copied

Don't use a calculation script.  The code was for a document script.

Here is an old article on entering document scripts, There have been some changes in the Acrobat UI, but most of the article is still acurate

https://acrobatusers.com/tutorials/js_document_scripts

Look up "Document JavaScripts" in the tool search

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

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 ,
Dec 05, 2017 Dec 05, 2017

Copy link to clipboard

Copied

LATEST

Looks tricky, but I'll give it a try. Thanks.

On Tue, Dec 5, 2017 at 10:01 PM Thom Parker <forums_noreply@adobe.com>

Votes

Translate

Translate

Report

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