Skip to main content
Participant
December 10, 2018
Question

How can I display numerics only, with a comma, and no decimal spaces can be entered?

  • December 10, 2018
  • 0 replies
  • 277 views

Hi all,

I'm currently using 2 types of script that essentially do the same thing perfectly, however, I want to also display the comma for large numbers:

Here's script 1:

if(!event.willCommit)

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


Here's script 2:

var reg = /^\d*$/;

event.rc = reg.test(event.value);

Does anyone know how I can add the comma to the scripts above or a new one do this?

Also note, I've already tried using the basic "number" in the format tab, but I do not want to display or allow the user to enter any decimals - so it has to be custom keystroke script I think.

The example above displays 8000 but I want it to display 8,000, I want the user to only be able to enter numerics and no other characters, or decimals (whole number only).


Any info would be appreciated
Thanks!

Alex

This topic has been closed for replies.