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

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

New Here ,
Dec 09, 2018 Dec 09, 2018

Copy link to clipboard

Copied

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.

Screen Shot 2018-12-10 at 12.49.11 pm.jpg

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

TOPICS
Acrobat SDK and JavaScript , Windows

Views

123

Likes

Translate

Translate

Report

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
no replies

Have something to add?

Join the conversation