Copy link to clipboard
Copied
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'?
Copy link to clipboard
Copied
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...
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now