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

Custom phone number with specific features

New Here ,
Oct 10, 2017 Oct 10, 2017

Copy link to clipboard

Copied

Hello!

I need to create an interactive PDF. I am a graphic designer and I do not know JavaScript.

In my PDF document I want user to enter his russian phone number in format +7 (111) 111-11-11.  Here "+7" is russian country code and it should be exactly like this.

I understand that user might try to input "+" or parentheses or he might forget to press spacebar or accidentally hit some letter.

So here is what I want exactly:

1. User can not type anything but digits. When he types any other symbol nothing happens. No warning or any other thing.

2. When user clicks on the field and inputs any symbol then this symbol should be changed automatically to +7 and an opening parenthesis should appear.

For example: user types 7 then this 7 gets replaced to +7 (

3. When user continues and type local area code like 963  the closing parenthesis should appear right after he types digit "3". At this point he should see +7 (963)

4. When user types next three digits a hyphen should appear. For example he types 123 and he should see +7 (963) 123-

5. Next is pretty straight forward. User types the next two digits and the second hypen appears. User types the last two digits and can not type any more characters.

So, to say it simple way I want Acrobat to auto-format user's typing into a form of a phone number.

At first I thought that the arbitrary mask is the best solution. But it does not do that I described above in 2. and 3. It also shows disgusting JavaScript warning "the value entered does not match....." when user types something wrong.

I am sure it can be done with a simple Java script but I do not know it at all.

TOPICS
Acrobat SDK and JavaScript , Windows

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
LEGEND ,
Oct 11, 2017 Oct 11, 2017

Copy link to clipboard

Copied

This is not simple and will require the of the RegExp object to define the acceptable keystrokes and then using the RegExp object again to provide the custom format script. Both are part of the "Custom" format option. If you need the values of the format to be restricted to given values for given positions then you will need write a custom JavaScript validation script again using the Reg Exp object.

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 ,
Oct 11, 2017 Oct 11, 2017

Copy link to clipboard

Copied

Gkaiseril, thank you for a reply! Unfortunately, I do not know JavaScript at all. I was hoping that what I want is easy and someone might post a needed code here. Besides that I think this kind of code might be useful for a lot of people who make interactive PDFs.

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 ,
Oct 12, 2017 Oct 12, 2017

Copy link to clipboard

Copied

LATEST

The "Arbitrary mask" was made for you (no JavaScript required): Acrobat XI Help | PDF form field properties

fo03.png

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