Skip to main content
Participant
September 24, 2018
Answered

How do I allow users to enter numbers and commas ONLY on input box

  • September 24, 2018
  • 2 replies
  • 790 views

Hi all,

What I am trying to do is, I have a form that I ask users to input department numbers separated by commas, but people are still entering department descriptions. I want to force them to only be able to enter numbers and commas, but no other characters. Something I could use in the Custom Keystroke Script box.

Any help would be greatly appreciated.

Thank you

Correct answer try67

Go to the field's Properties, Format, select Custom, and enter the following as the custom Keystroke script:

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

2 replies

JR Boulay
Community Expert
Community Expert
January 22, 2025

I have a variation on the above question: how can I do the same thing but limit the input to 2 digits after the decimal comma?

(In French format the decimal point is a decimal comma)

try67

Acrobate du PDF, InDesigner et Photoshopographe
try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
September 24, 2018

Go to the field's Properties, Format, select Custom, and enter the following as the custom Keystroke script:

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

Participant
September 24, 2018

Thank you so much try67. Your help is very much appreciated.

Regards

Chico..