Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

Explorer ,
Nov 17, 2025 Nov 17, 2025

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?

TOPICS
Create PDFs , Edit and convert PDFs , JavaScript , PDF , PDF forms
51
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
2 ACCEPTED SOLUTIONS
Community Expert ,
Nov 17, 2025 Nov 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 PDFScripting
Use the Acrobat JavaScript Reference early and often

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 17, 2025 Nov 17, 2025
LATEST

Custom calculation script in BoxC:

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

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

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 17, 2025 Nov 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 PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 17, 2025 Nov 17, 2025
LATEST

Custom calculation script in BoxC:

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

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines