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

Auto Fill Today's date into a PDF form

Guest
Apr 30, 2014 Apr 30, 2014

What is the easiest way to autofill in Today's Date in a text box each time a pdf form is opened?

I found some answers on the forum but the version of acrobat was different from mine and the menu options were not the same.  I am using Adobe standard 9.

Thanks,

Vanessa

TOPICS
PDF forms
73.0K
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 ,
Apr 30, 2014 Apr 30, 2014

You don't have direct access to the doc-level scripts in your version of Acrobat, but you can set do it via the console.
Run this code:

this.addScript("init", "this.getField(\"Today\").value = new Date();");

Of course, you should have a text field in your file called "Today", set up as a 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
Guest
Apr 30, 2014 Apr 30, 2014

Can you tell me how to get to the console? I tried following the instructions in the knowledge base but when I go to set preferences, again, my screen doesn't look like the example shown. I'm obviously a novice.

Vanessa Lo, PA-C

Premier Orthopaedics & Sports Medicine

Centennial Medical Center

2400 Patterson Street Suite 300

Nashville, Tennessee 37203

615-342-6368

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
Guest
Apr 30, 2014 Apr 30, 2014

Neveremind. I figured it out. However, it puts the date in this format : Wed Apr 30 2014 13:23:37 GMT-0500 (Central Daylight Time)". How can I change it to just mm/dd/yyyy.

Thanks.

Vanessa Lo, PA-C

Premier Orthopaedics & Sports Medicine

Centennial Medical Center

2400 Patterson Street Suite 300

Nashville, Tennessee 37203

615-342-6368

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
Guest
Apr 30, 2014 Apr 30, 2014

Nevermind..figured out that too. Just changed the format settings in the text box. Thanks again and sorry for speaking too soon....twice.

Vanessa Lo, PA-C

Premier Orthopaedics & Sports Medicine

Centennial Medical Center

2400 Patterson Street Suite 300

Nashville, Tennessee 37203

615-342-6368

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
Guest
Jun 15, 2014 Jun 15, 2014

Hi Gilad

I found your script above very useful to autopopulate a field with todays date.

this.addScript("init", "this.getField(\"Today\").value = new Date();");

I wonder if it is possible to lock it after the form has been opened so it doesn't update or change automatically. For example if I have a field with todays date in it using the script above. If I open the form tomorrow the same field would have tomorrow's date. Is there a way of keeping the field to todays date even though the form may be opened again in the future?

Regards,

Michael

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 17, 2014 Jun 17, 2014

Sure. Just change the code to:

this.addScript("init", "var f = this.getField(\"Today\"); if (f.value==\"\") f.value = new Date();");

You will need to completely reset the form if you want to update the field's value using this code.

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
Guest
Jun 21, 2014 Jun 21, 2014

Thanks Gilad, works perfectly!!

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 ,
Aug 22, 2014 Aug 22, 2014

Will this also work if some one uses the form on another computer?

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 ,
Aug 22, 2014 Aug 22, 2014

Yes, if they use an application that supports JS, of course.

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 ,
Aug 22, 2014 Aug 22, 2014

Another question If I may.

What is the best to:

Fill in another field with with data If a certain value is select from a drop down sections list?

Example:

Select from Drop Down = "Mt. Vernon - 42"

Field to fill is "Store Location" which would fill with "4545 Burlington blvd, Mt. Vernon, WA 981212" based on the drop down selection above.

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 ,
Aug 23, 2014 Aug 23, 2014

You can use something like this as the text field's custom calculation script:

var v = this.getField("Drop down field name").value;

if (v=="Mt. Vernon - 42") event.value = "4545 Burlington blvd, Mt. Vernon, WA 981212";

else if (v=="Something else") event.value = "Another address"; // etc.

else event.value = "";

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 ,
Aug 24, 2014 Aug 24, 2014

Thank you this helped so much

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 ,
Aug 25, 2014 Aug 25, 2014

Any great advice on configuring the Custom created Submit button to save to the following:

\\data\AP Monitored Folder

with the file name that = Field "PO Number" and "CurrentDateTime"

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 ,
Aug 25, 2014 Aug 25, 2014

That can only be done using a script that is installed on the local machine of each user who is going to use this file.

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 ,
Oct 13, 2014 Oct 13, 2014

A couple question if I may,

* What would your suggestion be for a fill-able text field that references a list of 300-400 Vendor Names? I wouldn't want if to be a big drop down list, but some thing that would populate as it was typed as an option.

* I want to know the best route for Putting my document on my server for network access via web browser so that it can be filled out as it was built and then saved when a submit button was hit, but it would net to accessed by multiple users at the same time?

Your suggestions and are greatly appreciated and continue to expand my knowledge.

Please let me know your thoughts.

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
Guest
Mar 08, 2017 Mar 08, 2017

Hi,

The drop-down to adjust the date doesn't seem to work on someone else's computer when I sent it over.

I used the javascript that you suggested.

Please advise.

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 ,
Mar 08, 2017 Mar 08, 2017

What application are they using to open the file with?

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
Guest
Mar 08, 2017 Mar 08, 2017

JavaScript as well.

I used this code in the Document JavaScript:

this.addScript("init", "var f = this.getField(\"Today\"); if (f.value==\"\") f.value = new Date();");

and named my text as "Today".

This works just fine on my computer (when I click on the text for date, a small drop-down shows up and once I click on it, I can adjust the date and keep it static). However, when I sent it over to my coworker, she only sees the date but is not able to see the drop-down icon once she clicks on it.

She's using the latest version of AdobePro as well.

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 ,
Mar 08, 2017 Mar 08, 2017

It would be useful to have a full-window screenshot of what they're seeing...

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
Guest
Mar 08, 2017 Mar 08, 2017

She is only able to see this on her computer:

However, on my computer (as I created the form), I can click on the date and a drop-down calendar shows up. She isn't able to do this.

Can you provide a solution to this? Or another JavaScript please? I would like the date to auto-populate when someone opens the PDF file, however remain static regardless of how frequently he/she opens the document at a later date. I would also like the other user (on their personal computer), have the option to change the date field from a calendar drop-down.

I really appreciate your help!

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 ,
Mar 08, 2017 Mar 08, 2017

Are you using a third-party calendar widget, or the built-in one in Acrobat? If the latter then it will only work as such in the very latest version of Acrobat/Reader DC. In all previous versions it's a simple text field that they need to fill in manually. There's no calendar pop-up.

And of course, if the field is set as Read-Only then the user can't interact with it...

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
Guest
Mar 08, 2017 Mar 08, 2017

No, I'm using the built-in one in Adobe PDF with the JavaScript suggested above, and of course I changed the format to dd/mm/yyyy. I didn't check off Read-Only or any other features.

This is what I see when I click on the text-field and an arrow + calendar pulls up:

This is what my co-worker isn't able to see on her computer when I send her the PDF file.

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
Guest
Mar 08, 2017 Mar 08, 2017

She is using the latest version of Adobe Pro as well.

Sorry for all the replies! This is driving me a little crazy.

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 ,
Mar 08, 2017 Mar 08, 2017

Adobe Acrobat X Pro is hardly the latest version... There are two major versions released after it: XI and DC.

What you're seeing will only be available in Acrobat DC, and only if the very latest update is installed.

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