Skip to main content
This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Apr 25, 2017 1:08 PM UTC

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;

5 replies

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Apr 25, 2017 1:08 PM UTC

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
dmdowsettAuthor
Participant
Apr 25, 2017 1:17 PM UTC

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
try67
Community Expert
Community Expert
Apr 25, 2017 2:01 PM UTC

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
Inspiring
Apr 25, 2017 1:02 PM UTC

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
dmdowsettAuthor
Participant
Apr 25, 2017 1:08 PM UTC

Right but it only seems to work on whole numbers.

Translate