Skip to main content
Inspiring
May 27, 2024
Answered

Align text field based on text entered in another field

  • May 27, 2024
  • 1 reply
  • 638 views

I'm wondering if this is possible.  I have two text fields - Text1 and Text2.  If text is entered into Text1, I would like Text2 to have an Alignment of Right.  If no text is entered into Text1, I would like Text2 to have an Alignment of Left.  Thanks for any help.

This topic has been closed for replies.
Correct answer BrianG934

Thank you!

1 reply

JR Boulay
Adobe Expert
May 28, 2024

Place this script as a "Validation script" in Text1:

if (event.target.value === event.target.defaultValue) {this.getField("Text2").alignment = "left";}
else  {this.getField("Text2").alignment = "right";}

 

Acrobate du PDF, InDesigner et Photoshopographe
BrianG934AuthorCorrect answer
Inspiring
May 28, 2024

Thank you!