Where have you placed this script?
How is the visibility of the Text1 field being controlled? It looks like a calculation script, which only will get triggered if a field value changes, not if the Text1 visibility changes.
I have placed the script in the Text2 fields custom calculation script.
What I need is for Text2 to only be visible if Text1 is visible and has content. If Text1 is blank or is not visible, then Text2 must not show.
For this to work as you want, it is important to know how the visibility of the text field is being controlled, for the reason I mentioned earlier.
Hi George - the visibility is based on a script in a checkbox. When the checkbox is selected, then the field becomes visible.
Thanks for the hints which led me to the right solution. I created a query to check if the trigger for the visibility was there or not, and this works. The script I have used is:
var v1 = getField("Text1").value;
var v2 = getField("Checkbox").value;
var v3 = getField("Text2").value;
event.target.display = (v1=="" || v3=="" && v2=="On" ) ?
display.visible : display.hidden;