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

Align text field based on text entered in another field

Explorer ,
May 27, 2024 May 27, 2024

Copy link to clipboard

Copied

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.

TOPICS
JavaScript , PDF , PDF forms

Views

98

Translate

Translate

Report

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

correct answers 2 Correct answers

Community Expert , May 28, 2024 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";}

 

Votes

Translate

Translate
Explorer , May 28, 2024 May 28, 2024

Thank you!

Votes

Translate

Translate
Community Expert ,
May 28, 2024 May 28, 2024

Copy link to clipboard

Copied

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";}

 

Votes

Translate

Translate

Report

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
Explorer ,
May 28, 2024 May 28, 2024

Copy link to clipboard

Copied

LATEST

Thank you!

Votes

Translate

Translate

Report

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