Answered
Hello,
In my form I have two text fields - "text3" and "text4." I want to add a visual cue that if either field contains data, the other one turns red until it too has data. My calculation script for "text3" looks like:
if( (this.getField("text4").value != null) && (this.getField("text4").value.length > 0) && (this.getField("text3").value.length == 0) )
event.target.fillColor = ["RGB",1,0.5,0.5]
else
event.target.fillColor = ["RGB",1,1,1]
This script works perfect...except if one of the field contains NUMBER characters ONLY.
Any thoughts as to why this would be or how to correct it?
Many thanks.
In this case, you should look at the "valueAsString" field property, as opposed to the "value" property. The code can be simplified to:
But I would suggest not using the Calculate event for this. Something like it really belongs in the Validate event of both fields.
George