Skip to main content
Inspiring
November 17, 2025
Answered

If two text boxes contain the same text, populate another text box

  • November 17, 2025
  • 2 replies
  • 58 views

If BoxA says "123 Seasame St" and BoxB also says "123 Seasame St", I need BoxC to say, "*TO OURSELVES*" Is there a script to do this?

Correct answer PDF Automation Station

Custom calculation script in BoxC:

if(this.getField("BoxA").value=="123 Seasame st" && this.getField("BoxB").value=="123 Seasame St")

{event.value="*TO OURSELVES*"}

2 replies

PDF Automation Station
Community Expert
Community Expert
November 17, 2025

Custom calculation script in BoxC:

if(this.getField("BoxA").value=="123 Seasame st" && this.getField("BoxB").value=="123 Seasame St")

{event.value="*TO OURSELVES*"}

Thom Parker
Community Expert
Community Expert
November 17, 2025

Yes, use a calculation script on "BoxC".

Like this:

if(this.getField("BoxA").value == this.getField("BoxB").value)
    event.value = "*TO OURSELVES*";
else 
    event.value = "";

 

Note that if BoxA and BoxB do not match, that the value is made blank.  

There may also be an additional issue. The text in both may be equivalent, but not equal. For example, if there are extra spaces in one of the fields. If this is the case, then some more code will be necessary to clean up the field values before comparing. 

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often