On a form I'm making it's important that if the value of say 'field1' is less than the value of 'field2' that the appearance of 'field1' in some way changes. That being the colour of the font or maybe the background colour of the field (this is to alert the person processing the form).
If anyone could point me in the right direction it would be very much appreciated. I've been struggeling with this for quite awhile now.
// Get the value of the other field, as a string
var s2 = getField("t2").valueAsString;
// Get the value of this field, as a string
var s1 = event.value;
// If both fields are not blank and value of s1 is less than s2,
// set background color to red, otherwise white
event.target.fillColor = (s1 && s2) && (+s1 < +s2) ? color.red : color.white;
Replace "t2" with the actual name of field2. You can also adjust the colors to suit your needs. To change the text color instead, use the textColor property, or the strokeColor property to alter the border color.
It works perfectly. Thank you very much for your help.