Conditional Formatting Based on Text Input and Dropdown Choices

Community Beginner ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

I have a form where we record angles from 3 sides. Call them Pos 1, Pos 2, Pos 3. I have a column called Angle Average that averages those three numbers. Now we have 4 different items that are measured with different angle requirments. Call them 10, 11, 12, 13. I have a drop down that lets you pick the item and then the Angle requirement populates in the next box.

 

What I'm trying to do is two-fold:

1) I would like to get the Angle Average box to color Green or Red if it equals or is less then the Angle requirement for the selected Item

2) I want to use 1 form for all 4 items. So picking the Item from the dropdown would change the Angle requirement and therefore the Angle Average coloring would be based on that angle.

 

So if I picked Item 10 with a 21 angle requirement then the Angle average box would color green or red based on if the average was less then or equal to 21. But if I picked Item 11 and the angle changed to 30 then the Angle Average box would change to green or red based on if it was less then or equal to 30.

 

I hope this makes sense. I've gotten most of the formula in but I can't quite make this work.

TOPICS
JavaScript , PDF forms

Views

37

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
community guidelines

correct answers 1 Correct answer

Community Beginner , Sep 23, 2022 Sep 23, 2022

Got it to work!

var an = this.getField("Text4").value;
var ma = this.getField("Text108").value
if(Number(an)<= (Number(ma)))
event.target.fillColor = color.green;
else event.target.fillColor = color.red;

Likes

Translate

Translate
Enthusiast ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

It does make sense, but if you can please share your file, it would be much easier to help you.

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
community guidelines
Community Beginner ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

Unfortunately that will not be possible. The document is internal and proprietary. I used generalizations above to demonstrate what I am trying to do. 

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
community guidelines
Community Beginner ,
Sep 23, 2022 Sep 23, 2022

Copy link to clipboard

Copied

QAManager_0-1663952709156.png

Here is a redacted screen shot. Basically I am trying to get a formula that will compare the Angle average to the Maximum Included angle. If the Angle average is less then or equal to the Max Included Angle I want the box color to change to green. If not I want the box to highlight as red. I hope that helps. I'm working on formatting some code right now and I'll post what I have soon but any guidance in the meantime would be appreciated.

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
community guidelines
Community Beginner ,
Sep 23, 2022 Sep 23, 2022

Copy link to clipboard

Copied

Here is the code I've come up with so far (it doesn't work)

var an = this.getField("Text4").value;
var ma = this.getField("Text108").value
if(Number(an)<= (Number(ma)))
event.target.textColor = color.green;
else event.target.Color = color.red;

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
community guidelines
Community Beginner ,
Sep 23, 2022 Sep 23, 2022

Copy link to clipboard

Copied

LATEST

Got it to work!

var an = this.getField("Text4").value;
var ma = this.getField("Text108").value
if(Number(an)<= (Number(ma)))
event.target.fillColor = color.green;
else event.target.fillColor = color.red;

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
community guidelines

Make content for your business needs with Adobe Express.

Get started easily with free templates: