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

How to Allow Only Certain Characters to be typed in a Field

New Here ,
Jan 17, 2017 Jan 17, 2017

Copy link to clipboard

Copied

Hello everyone,

I have only recently started working with Adobe Acrobat Pro, so my apologizes if this a rather simple question.

I am trying to create fields for telephone numbers. I am aware that in the Format Category there is an option for phone numbers.  However, only works for 10 character phone numbers.  For people living in other countries, this may be a problem.

What I would like to know is that is there a way to set a field so that only the user can only input certain characters.  For this particular field I would like them to be only able to input numbers "0-9", dashes " - ", periods " . " , or Parenthesis " ( ) " .  They do not need to be in a particular order.

I appreciate the help!

TOPICS
PDF forms

Views

2.6K

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 ,
Jan 17, 2017 Jan 17, 2017

Copy link to clipboard

Copied

This kind of validation is best done using something called a Regular Expression. You can read up about it how to use them in JavaScript, but here's the code that achieves what you described. It should be entered as the field's custom Keystroke script:

if (event.change) {

     event.rc = /^[0-9,\.\(\)]+$/.test(event.change);

}

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 ,
Jul 20, 2022 Jul 20, 2022

Copy link to clipboard

Copied

This is great. Is there a way so that the numeric keyboard is still displayed by default using ipad?

 

Cheers.

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 ,
Jul 20, 2022 Jul 20, 2022

Copy link to clipboard

Copied

LATEST

No.

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 ,
Jan 17, 2017 Jan 17, 2017

Copy link to clipboard

Copied

As noted this can be done with the Regular Expression object. For a specific country we would need to know the format of the phone numbers for that country.

Acrobat is supplied with the U.S, and Canadian phone number masks. These masks include the keystroke, validation, and formatting masks.

You might be able find the formatting masks on the Internet but the keystroke and validation masks are unique to Acrobat forms.

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