Copy link to clipboard
Copied
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.
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;
Copy link to clipboard
Copied
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".
Copy link to clipboard
Copied
Right but it only seems to work on whole numbers.
Copy link to clipboard
Copied
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;
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Sorry, I didn't notice you want it to be red if it's outside that range. Yes, changing the colors should solve that.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now