Highlighted

Conditional formatting based on value of another form field

New Here ,
Jul 30, 2020

Copy link to clipboard

Copied

Hello! I need to change bg color of a field simply based on the text contents of another field on a different page. I've been researching for hours trying to find this seemingly simple code and tried numerous times based on other forums but have been unsuccessful. I have come across numerous answers for numerical values and calculations but nothing for a simple text input.

 

For example, I need the "RingGear" field on page 1 to be highlighted green if the value of "RingGearValue" (on page 4)  = "OK", and highlighted red if the value "RingGearValue" = "CAUTION", otherwise transparent.

 

Thank you!

Use this as Custom calculation script of "RingGear" field

var e = this.getField("RingGearValue").value;
var f = this.getField("RingGear");
if( e == "OK"){
  f.fillColor = color.green;
}else
 if( e == "CAUTION"){
  f.fillColor = color.red;
}else f.fillColor = color.transparent;
TOPICS
PDF forms

Views

50

Likes

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

Conditional formatting based on value of another form field

New Here ,
Jul 30, 2020

Copy link to clipboard

Copied

Hello! I need to change bg color of a field simply based on the text contents of another field on a different page. I've been researching for hours trying to find this seemingly simple code and tried numerous times based on other forums but have been unsuccessful. I have come across numerous answers for numerical values and calculations but nothing for a simple text input.

 

For example, I need the "RingGear" field on page 1 to be highlighted green if the value of "RingGearValue" (on page 4)  = "OK", and highlighted red if the value "RingGearValue" = "CAUTION", otherwise transparent.

 

Thank you!

Use this as Custom calculation script of "RingGear" field

var e = this.getField("RingGearValue").value;
var f = this.getField("RingGear");
if( e == "OK"){
  f.fillColor = color.green;
}else
 if( e == "CAUTION"){
  f.fillColor = color.red;
}else f.fillColor = color.transparent;
TOPICS
PDF forms

Views

51

Likes

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
Jul 30, 2020 0
Adobe Community Professional ,
Jul 30, 2020

Copy link to clipboard

Copied

You can check the content of text fields like this:

if (this.getField("RingGearValue").value  == "OK") {

 

}

Likes

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
Reply
Loading...
Jul 30, 2020 1
Engaged ,
Jul 30, 2020

Copy link to clipboard

Copied

Use this as Custom calculation script of "RingGear" field

var e = this.getField("RingGearValue").value;
var f = this.getField("RingGear");
if( e == "OK"){
  f.fillColor = color.green;
}else
 if( e == "CAUTION"){
  f.fillColor = color.red;
}else f.fillColor = color.transparent;

Likes

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
Reply
Loading...
Jul 30, 2020 1
Dana2203 LATEST
New Here ,
Jul 30, 2020

Copy link to clipboard

Copied

Thank you so much! Just what I needed. I appreciate the help very much!

Likes

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
Reply
Loading...
Jul 30, 2020 0