Suppose I have two text fields Text1 and Text2. I want to make it so that when the user is done entering a value in Text1, then Text2's value should be set to "NA." Conversely, after a value is entered into Text2, then Text1's value should be changed to "NA." In other words Text1 and Text2 cannot both have distinct values. How do I do this?
// Custom calculate script for Text1
var f = getField("Text2");
if (event.source && event.source === f) {
if (f.valueAsString) {
event.value = "NA";
} else {
event.value = "";
}
}
The script for Text2 would be the same, but replace "Text2" with "Text1". The code blanks the other field if the current field is blanked. You may not want this, but it seems reasonable to me.