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

restricting form field to numbers without separators on XI

New Here ,
Mar 02, 2019 Mar 02, 2019

restricting form field to numbers without separators XI

TOPICS
PDF forms
2.7K
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
1 ACCEPTED SOLUTION
Community Expert ,
Mar 03, 2019 Mar 03, 2019

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);

View solution in original post

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 ,
Mar 03, 2019 Mar 03, 2019

Hi

Capture.png


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
Community Expert ,
Mar 03, 2019 Mar 03, 2019

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);

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 ,
Mar 03, 2019 Mar 03, 2019

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 ,
Mar 04, 2019 Mar 04, 2019

Correct.

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
Contributor ,
Aug 11, 2022 Aug 11, 2022

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.

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 ,
Aug 11, 2022 Aug 11, 2022

In that case I recommend using the Arbitrary Mask under Format - Special. You can specify this pattern like this (for example):

+99 999 9999

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

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) 

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

Letters only: event.rc = /^[a-z]*$/i.test(event.change);

Letters and digits only: event.rc = /^[a-z\d]*$/i.test(event.change);

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 12, 2022 Oct 12, 2022
LATEST

Perfect! Thank You so much 

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