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

Automatically Set Date and Time Without Document Level Javascript When Opening the Form

New Here ,
Aug 07, 2018 Aug 07, 2018

Copy link to clipboard

Copied

Hi all,

I am currently using Adobe Acrobat DC (not pro), and so I do not have access to document level javascript for some reason. However, what I do have, is a form that I created a long time ago, with a date and time field that automatically fills updates when the form is opened. However, when I copy the exact field into a different form, the date and time stays as what it was when I copied it over, and won't update when the form is reopened.

I can't remember how I originally set the date and time field up, but I know for a fact that I have never owned Adobe Acrobat DC Pro (And so have never had access to document level javascript).

How can I set this up without Document level javascripting that executes when the form is opened? How is it possible that somewhere in the code of my old form it already sets the date and time but it's not done within the date and time field itself? How would I go about finding where that Javascript is?

If anybody has any ideas, I would love to hear them.

Thanks so much in advance!

Christopher

TOPICS
Acrobat SDK and JavaScript , Windows

Views

1.7K

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 , Aug 08, 2018 Aug 08, 2018

Open the old document with the script.

Add the pages of the new document.

Delete the pages of the old document.

Save the document with the new name.

Votes

Translate

Translate
Community Expert ,
Aug 07, 2018 Aug 07, 2018

Copy link to clipboard

Copied

I strongly suspect that the time is being set with a script. There are no other mechanisms for this in Acrobat. But to be sure, one way to test this is to turn off JavaScript in the Acrobat Preferences. If the form doesn't update, you know it's a script.  You could also post the form and I'll take a look.

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 ,
Aug 08, 2018 Aug 08, 2018

Copy link to clipboard

Copied

I tried this, and there is definitely a script setting the date and time. If the only way to do this is through document level scripting, is it possible that an older version of Adobe Acrobat Standard DC allowed me to use this feature?

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 ,
Aug 08, 2018 Aug 08, 2018

Copy link to clipboard

Copied

Open the old document with the script.

Add the pages of the new document.

Delete the pages of the old document.

Save the document with the new name.

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 ,
Aug 07, 2018 Aug 07, 2018

Copy link to clipboard

Copied

Adobe Acrobat Standard can also add document level scripts.

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 ,
Aug 08, 2018 Aug 08, 2018

Copy link to clipboard

Copied

That's what I've read online as well. However, when I go to "JavaScript" in tools I get this message: "You need Acrobat Pro to access this tool. Step 1: Click Buy Now to purchase a licence. Step 2: Return to Acrobat and click Activate to apply the licence".

This seems bizarre because there are some pretty fundamental features that I can't seem to access with the program. Am I doing something wrong on my end in terms of the licences I've activated?

Thanks!

BarlaeDC​

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
LEGEND ,
Aug 08, 2018 Aug 08, 2018

Copy link to clipboard

Copied

You can open the JavaScript console and type the code to add a script action to the document level of the PDF.

this.addScript("AutoDateScript", "function AddDate(){this.getField(\"Today\").value = util.printd(\"d mmm yyyy\", new Date());return true;}AddDate();");

The script will run the next time you open the file. This script assumes you have an existing field named "Today".

It is also possible to add document level JavaScript using an FDF file and then importing that file into the PDF. And with even more JavaScript and creating folder level functions, it is possible to even have Reader add a document level script.

Automatic Insertion of Document-Level JavaScripts by Dr. D. P. Story

It is also possible to add the action to the "Open Page" action. But one may need to add some additional code so as not to run the page open action after it has run for the current opening of the PDF.

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 ,
Aug 08, 2018 Aug 08, 2018

Copy link to clipboard

Copied

Hi,

If you open the form, and then open the JavaScript tool bar ( goto the tools panel and type JavaScript), there is an option called "All JavaScripts" that will show you all the JavaScripts in the document. it will be blank apart from a heading if there are no JavaScripts.

If there is a script you can just copy and paste into the new form, and that should copy the functionality over, although you may be copying more scripts than you actually need.

Regards

Malcolm

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
LEGEND ,
Aug 08, 2018 Aug 08, 2018

Copy link to clipboard

Copied

LATEST

Document all JavaScripts contains warnings about editing this file. There are special XML tags within the field and if any are changed or deleted one may not be able to open the PDF.

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