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!
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);
}
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.
Copy link to clipboard
Copied
No.
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.