Copy link to clipboard
Copied
restricting form field to numbers without separators XI
Technically, that still allows the user to enter the minus symbol and a period.
If you really want to only allow numbers you can use this code as the custom Keystroke script:
event.rc = /^\d*$/.test(event.change);
Copy link to clipboard
Copied
Hi
Copy link to clipboard
Copied
Technically, that still allows the user to enter the minus symbol and a period.
If you really want to only allow numbers you can use this code as the custom Keystroke script:
event.rc = /^\d*$/.test(event.change);
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Correct.
Copy link to clipboard
Copied
Hi Gilad,
I found this really useful, thanks for the post.
I've tried to amend the reg exp to allow a '+' symbol, for a telephone number area code, and spaces but as yet no luck. Please can you point me in the right direciton.
Thanks in advance.
Copy link to clipboard
Copied
In that case I recommend using the Arbitrary Mask under Format - Special. You can specify this pattern like this (for example):
+99 999 9999
Copy link to clipboard
Copied
I am a newbie in javascript, Please can you help me, a code allows Alphabet characters only or both Alphabetic and numbers (symbols/special characters restricted)
Copy link to clipboard
Copied
Letters only: event.rc = /^[a-z]*$/i.test(event.change);
Letters and digits only: event.rc = /^[a-z\d]*$/i.test(event.change);
Copy link to clipboard
Copied
Perfect! Thank You so much