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

How can I use conditional formatting for numbers with up to 5 decimal places.

New Here ,
Apr 25, 2017 Apr 25, 2017

I have a number range from 1.77150 to 1.77221 and I would like it to turn red if it is outside that range.

TOPICS
Acrobat SDK and JavaScript , Windows
705
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

correct answers 1 Correct answer

Community Expert , Apr 25, 2017 Apr 25, 2017

As the field's custom validation script enter this code:

if (event.value>=1.77150 && event.value<=1.77221) event.target.textColor = color.red;

else event.target.textColor = color.black;

Translate
LEGEND ,
Apr 25, 2017 Apr 25, 2017

You have to use the custom JavaScript option on the Validation tab for the field's properties. Since you are focused on that field when validating, use the "event.value".

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 ,
Apr 25, 2017 Apr 25, 2017

Right but it only seems to work on whole numbers.

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 ,
Apr 25, 2017 Apr 25, 2017

As the field's custom validation script enter this code:

if (event.value>=1.77150 && event.value<=1.77221) event.target.textColor = color.red;

else event.target.textColor = color.black;

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 ,
Apr 25, 2017 Apr 25, 2017

OK, for some reason that didn't work, but I changed the color coding around so first line black and second line red and that was it, thank you.

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 ,
Apr 25, 2017 Apr 25, 2017
LATEST

Sorry, I didn't notice you want it to be red if it's outside that range. Yes, changing the colors should solve that.

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