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

Changing border color of a separate text field

New Here ,
Jul 13, 2024 Jul 13, 2024

Copy link to clipboard

Copied

I need to change the border color of a text field from black to red based on information from two other text fields.  Let's say I have X and Y.  X is the field on which we want to change the border color based on the Y value.  But this Javascript needs to be added to the Custom Calculation Script of Y.

 

If X is greater than 1 and Y is greater than X, then change the border color of X to red else black.

 

How can I do this?

TOPICS
PDF forms

Views

97

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 1 Correct answer

Enthusiast , Jul 13, 2024 Jul 13, 2024

Enter the following custom calculation script in Y:

 

if(this.getField("X").value>1 && event.value>this.getField("X").value)
{
this.getField("X").borderColor=color.red
}
else
{
this.getField("X").borderColor=color.black
}

Votes

Translate

Translate
Enthusiast ,
Jul 13, 2024 Jul 13, 2024

Copy link to clipboard

Copied

Enter the following custom calculation script in Y:

 

if(this.getField("X").value>1 && event.value>this.getField("X").value)
{
this.getField("X").borderColor=color.red
}
else
{
this.getField("X").borderColor=color.black
}

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
Community Expert ,
Jul 14, 2024 Jul 14, 2024

Copy link to clipboard

Copied

The borderColor property is deprecated. You should use strokeColor, instead.

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
New Here ,
Jul 16, 2024 Jul 16, 2024

Copy link to clipboard

Copied

LATEST

This works, thank you.  But I am having a weird problem.  I am using this on two Y fields, and it only seems to work for one when I have the code installed on both.  The person filling out the form will only use one of the Y fields. They have to choose depending on their situation.  Is there any reason why it only works for one Y field if both have the same code?

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