Skip to main content
Participant
Sep 24, 2018 7:18 PM UTC
Answered

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

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

try67
try67Correct answer
Community Expert
Sep 24, 2018 7:38 PM UTC

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

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

3 replies

JR Boulay
Community Expert
Community Expert
Jan 22, 2025 2:26 PM UTC

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

Translate
Acrobate du PDF, InDesigner et Photoshopographe
try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Sep 24, 2018 7:38 PM UTC

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

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

Translate
Participant
Sep 24, 2018 7:47 PM UTC

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

Regards

Chico..

Translate