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

Format Date Form Field in Adobe Acrobat Pro

New Here ,
Aug 30, 2013 Aug 30, 2013

Thanks in advance for your help. I have date fields in an Acrobat form. Is it possible to create a script to format a date as either MM/DD/YYYY or MM/DD/YY? In other words, if someone enters MM/DD/YYYY, the date would be accepted and MM/DD/YY would also be accepted. Thanks, again.

TOPICS
PDF forms
26.8K
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
1 ACCEPTED SOLUTION
Community Expert ,
Aug 30, 2013 Aug 30, 2013

I think an error dialog is better than an unclear value. Millions (if not

more) of dollars and thousands (if not more) of man hours were spent on

solving the Y2K bug. Don't fall in the same trap...

View solution in original post

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 30, 2013 Aug 30, 2013

You can write your own custom validation script to allow that, but I would

recommend against 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
New Here ,
Aug 30, 2013 Aug 30, 2013

Thanks for your response. There is really no other way to control the format of the date? I would just like the date field to accept either mm/dd/yyyy or mm/dd/yy. (It would be great if the date could automatically be converted to mm/dd/yyyy, but if I enter anything other than mm/dd/yyyy, a dialog box appears indicating that the data was not in correct format.) Thanks, again!

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 30, 2013 Aug 30, 2013

How would you make that conversion? Let's say the user enters "12/10/50".

Is that 2050 or 1950?

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 30, 2013 Aug 30, 2013

Good point. To be honest, it could be either. The dates entered are generally birthdates and signature dates. The birthdates could be 19XX or 20XX. The signature dates would be 20XX. I'm just trying to avoid an error dialog when the user enters a date as mm/dd/yy or m/d/yy. Thanks for your insight and 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 ,
Aug 30, 2013 Aug 30, 2013

I think an error dialog is better than an unclear value. Millions (if not

more) of dollars and thousands (if not more) of man hours were spent on

solving the Y2K bug. Don't fall in the same trap...

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 30, 2013 Aug 30, 2013

You are right! Thanks for 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
LEGEND ,
Aug 30, 2013 Aug 30, 2013

Most life insurance companies figured out the solution in the early 1970's when their annuitants who were born in the 1870's had a birthday.

The use of the 2 digit year was based on the cost of storage and the lack of input space on Hollerith cards (IBM punch cards). All issues that have now been resolved.

With the shrinking globe and cheap storage, use of the day-month-full year, d-mmm-yyyy, more clearly identifies the date than ##/##/## which could be any combination or month day and year.

This is not rocket science or is 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
Community Expert ,
Aug 31, 2013 Aug 31, 2013

This is not rocket science or is it?

No, it's not... Did I say it was?

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
Mentor ,
Aug 31, 2013 Aug 31, 2013

Might need a DuPont Engineer towork it out though.

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 ,
Sep 01, 2013 Sep 01, 2013

Since the time measurement is based on a sattilite revolving around another object in space, much of the concepts and measurements apply to rocket science. But I do not know if all rocket scientist woudl get it. Wasn't there a sattilite that mixed miles and kilometers within the navigation program with a suprising result.

One needs to get to a common unit and then just do the math.

Actually JavaScript does have an adjustment for the Date.getYear if the date object is established with the 4 digit year.

I had a recent issue at work. I work from the U.S and have to access data on a server in the UK using Remote Desktop and the remote deskto is configured for the UK date format unless the user changes it. In prior years the data was processed on servers in the U.S. with U.S. date format. There were many instances when the date and month were swithed and requires over a month to fix. Thank you Microsoft Certified Network Administrators.

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
Sep 01, 2013 Sep 01, 2013

To avoid possible confusion due to inconsistent user inputs, have you thought of having 3 combo boxes, one each for day, month and year?

Combo boxes are a good way to force the user to pick a specific response.

The user's choices from the combo boxes can then be imported into a text field on your form.

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 ,
Sep 02, 2013 Sep 02, 2013

I would recommend against that, as that involves a lot of scripting changing the days drop-down according to the selected month and year.

Just use a text field with a pre-defined date format. That will take care of all of these issues for 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
New Here ,
Feb 20, 2017 Feb 20, 2017

Under text field's property > option, you can limit amount of character in the text field.

Then, under validation, choose "Run custom validation script" with the following script:

//Force the text field only accept numeric value//

var alphaNumericPatt = /^[0-9]*$/;
event.rc = alphaNumericPatt.test(event.value);

//Break the string into three group of numbers//

var dobD = event.value.substring(0,2)
var dobM = event.value.substring(2,4)
var dobY = event.value.substring(4,8)

// Combine the string with "/" as divider to the format like this DD/MM/YYYY //
var dobFull = dobD + "/" + dobM + "/" + dobY

event.value = dobFull

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

When entering date in dd/mm/yyyy format into received Adobe PDF forms, I always got a JavaSript error telling that date format should be m/d/y. JavaSript then  automatically reverts my entered date to this format ! And this with any Internet browser, even with default languages set to English UK or French and Windows 7 date  set to European format.

                  

I found many complaints and questions on this subject on the WEB, but except some very technical Java programming suggestions, I found no solutions.

But finally, playing with one of PDF forms, I FOUND A SIMPLE SOLUTION !

  1. 1. DOWNLOAD THE REQUIRED PDF FORM AND SAVE IT AS PDF FILE, THEN OPEN THIS FILE
  2. 2. Click on  EDIT, then PREFERENCES and select JAVASCRIPT from a roll-down list
  3. 3. UNCHECK the "Enable Acrobat JavaScript"
  4. 4. Click OK
  5. 5. Now, you can ENTER DATE IN DD/MM/YYYY FORMAT and JavaScript will not modify it !

Cheers !

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

But will it be a valid date and will it be the date the user wanted entered?

Also you will be eliminating a lot of other JavaScript actions that maybe needed by the form. An example would be the computing of the age based on the date of birth entered.

One can use the RegExp option for the custom keystroke, custom format, and custom validation to get this to work, but one still needs to deal with the issue of dates that could be spanning more than 100 years.

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

Well, this was concerning of entering a birth date into the received form.

And after disabling JavaScript, I could enter date in any wanted form and it was kept as it is when printing or sending the response via email. There was no other modification done by disabling JavaScript. So, it did work!

Maybe for particular applications like calculating the age from entered date it won't work, but then it would require programming knowledge that average user having to fill-in the form doesn't have, nor needs for such a simple usage.

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

It worked on your end, sure, but when you submit it back to them and they try to export the data and import it into their database, for example, it will fail and your form will be rejected.

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 ,
Dec 23, 2017 Dec 23, 2017
LATEST
Maybe for particular applications like calculating the age from entered date it won't work, but then it would require programming knowledge that average user having to fill-in the form doesn't have, nor needs for such a simple usage.

It is up to the form author to add the script necessary to have the form perform calculations and other automated tasks not the person entering the form data. In fact, since most of the users filling in the form will be using Adobe Reader or other application, they will not have the ability to access the JavaScripts or use the JavaScript editor.

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