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

Calculating a date in a PDF form

Community Beginner ,
Sep 26, 2017 Sep 26, 2017

Copy link to clipboard

Copied

I'm trying to conditionally fill in a date in a PDF form.  I have located a script that automatically enters today's date in the form, but I want to make the automatic date populate the field ONLY if the field is blank.

In other words, if a date already exists in the field, I'd like Acrobat to not replace the date with today's date.  This is the script I'm currently using:

event.value = util.printd("m/d/yyyy", new Date());

Can someone help me out here?  Thank you.

Noob
Cleveland, Ohio

Thank you in advance.

TOPICS
PDF forms

Views

766

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

correct answers 1 Correct answer

Community Expert , Sep 26, 2017 Sep 26, 2017

Use this code:

if (event.target.valueAsString=="")

    event.value = util.printd("m/d/yyyy", new Date());

Votes

Translate

Translate
Community Expert ,
Sep 26, 2017 Sep 26, 2017

Copy link to clipboard

Copied

Use this code:

if (event.target.valueAsString=="")

    event.value = util.printd("m/d/yyyy", new Date());

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 Beginner ,
Sep 26, 2017 Sep 26, 2017

Copy link to clipboard

Copied

LATEST

You guys are rocks stars!  Thanks.  Works perfectly.

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