Skip to main content
Known Participant
February 10, 2025
Answered

1st precedence out of two text boxes.

  • February 10, 2025
  • 2 replies
  • 331 views

Good Day Experts, 

         My issue today is that I have two text boxes I need to reflect into one text box based on precedents. If my first text box has an entry, I would like it to display the first text box. But if there is an entry in the second text box, I would like it to display what is in the second text box. Is this possible?

 

Correct answer Nesa Nurani

You want to show value in 3rd field?

You could use this as custom calculation script of 3rd field (change "Text1" and "Text2" to your actual field names of first and second 'text boxes'):

var t1 = this.getField("Text1").valueAsString;
var t2 = this.getField("Text2").valueAsString;

if(t2 !== "")
 event.value = t2;
else if(t1 !== "")
 event.value = t1;
else
 event.value = "";

2 replies

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
February 10, 2025

You want to show value in 3rd field?

You could use this as custom calculation script of 3rd field (change "Text1" and "Text2" to your actual field names of first and second 'text boxes'):

var t1 = this.getField("Text1").valueAsString;
var t2 = this.getField("Text2").valueAsString;

if(t2 !== "")
 event.value = t2;
else if(t1 !== "")
 event.value = t1;
else
 event.value = "";
PDF Automation Station
Community Expert
Community Expert
February 10, 2025

Enter the following custom validation script in the first text box:

this.getField("SecondTextBox").value=event.value;