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

Arbitrary mask

New Here ,
May 12, 2021 May 12, 2021

I want to allow up to 3 digits in a text field but if I enter 999 under the Arbitrary Mask option and only enter 2 digits in the fillable field when testing the form, I get an error message. Is there a way to type in a symbol to indicate 'up to 3 digits'?

TOPICS
How to , PDF forms
436
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
New Here ,
Oct 23, 2025 Oct 23, 2025

i have the same exact problem , and i'm afraid the only way is to resort to a JavaScript snippet of code and RegEx.

Cheers...

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 ,
Oct 23, 2025 Oct 23, 2025

There is no need for JavaScript for something this simple.

In the field properties:
- Format: use the number format, without decimals
- Options: limit input to 3 characters


Acrobate du PDF, InDesigner et Photoshopographe
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
New Here ,
Nov 07, 2025 Nov 07, 2025

Thank you JR.

Your solution will probably fit a range of cases.

What i didn't specify in my first message though , is that i need that field to be used for a UK phone number.

This means that i need the leading zeros to stay , and not sure but i might also need some flexibility like the possibility to insert 10 or 11 digits.

So , at the moment seems like the JavaScript RegEx is the way to go , for me.

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 ,
Nov 07, 2025 Nov 07, 2025
LATEST

So, instead of using the "number" format, use this script as as "Format : Custom keystroke script":

event.rc = /^\d*$/.test(event.change);

 It will keep the leading zero.


Acrobate du PDF, InDesigner et Photoshopographe
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