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

Is there a way to allow for multiple date formats?

Community Beginner ,
Jul 08, 2019 Jul 08, 2019

Copy link to clipboard

Copied

There is a section of my form that asks for a person's date of birth. I would like for the field to allow the date of birth to be entered only in the following formats:

1. m/d/yyyy

2. m/d/yy

The Date Format under Text Field Properties only allows for one to be selected and I was wondering if there was any way to allow for multiple? I would prefer that the date of birth is displayed showing 4 digits for the year but I do not want it to give an error and cause any frustration if it's entered using only 2 digits for the year.

TOPICS
Acrobat SDK and JavaScript

Views

183

Likes

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 , Jul 08, 2019 Jul 08, 2019

Hi,

I think you would need to create a custom validation script, that took the value from the field, and checked it matched either of your options.

Regards

Malcolm

Likes

Translate

Translate
Community Expert ,
Jul 08, 2019 Jul 08, 2019

Copy link to clipboard

Copied

How would you know if "18" means "2018" or "1918"?

Likes

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 ,
Jul 08, 2019 Jul 08, 2019

Copy link to clipboard

Copied

This form is used to set up web accounts so we are assuming that the user would be younger than 100.

Likes

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 ,
Jul 08, 2019 Jul 08, 2019

Copy link to clipboard

Copied

Don't assume anything. You don't know what kind of users you might have or what they might want to do.

Maybe someone is creating a website for their grandparent (born in 1918), or their child (born in 2018)?

Millions of dollars were spent on trying to fix the Y2K bug and you want to intentionally introduce it to your forms? That's a bad idea. Just have the users spend the extra half second it takes to type in those two numbers. It might save you a lot of time and effort in the future (and the present, as you won't have to start writing custom format and validation scripts).

Likes

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 ,
Jul 08, 2019 Jul 08, 2019

Copy link to clipboard

Copied

Hi,

I think you would need to create a custom validation script, that took the value from the field, and checked it matched either of your options.

Regards

Malcolm

Likes

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 ,
Jul 08, 2019 Jul 08, 2019

Copy link to clipboard

Copied

LATEST

Allowing either is largely unnecessary. If you did want to allow either, you'd write a validation script that would check if a valid date (in any format) were entered and then a format script to put the entered date into one of the two you'll accept... but in the end, your script will still need to pick one of two as the final format.

Likes

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