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

Form Field formatting, SSN, Phone#, and Date

Participant ,
May 05, 2023 May 05, 2023

I can format a form field for specific types of data.

Example 1. SSN, since everyone's SSN is 9 digits, when you type in the field 123456789, if I Custom format the field as SSN, Acrobat automatically knows where to place the dashes 123-45-6789.

Example 2. Phone #, since the typical telephone number in the US is 10 digits, when you type 8005555555. if I Custom format the field for telephone #, Acrobat automatically knows where to place the ()'s, space and dash.  (800) 555-5555.

My question is with the date:

Example 3. Date, If I simply enter 1232023, Acrobat would not know if I meant 1/23/2023 or 12/3/2023.  But if I Custom format a Date field as MM/DD/YYYY, why won't it accept 01232023 and place the /'s after the 2nd number and the 4th number?

I guess, what I'm trying to ask is, is there a way to enter a date without having to enter either -'s or /'s ?

TOPICS
Create PDFs , Edit and convert PDFs , How to , JavaScript , PDF , PDF forms
1.6K
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 ,
May 05, 2023 May 05, 2023

For 8 numbers 01232023 you can use this:

var str = event.value;
str = util.printx("99/99/9999", str);
if(event.value)
event.value = str;

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
Participant ,
May 05, 2023 May 05, 2023
LATEST

As always, thanks Nesa.

Yes, that works, but now is seems like you can't enter 5/5/2023.

Is there a way for the date field to accept both 5/5/2023 and 05052023?

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