Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Highlighting a field when a condition is met

Avatar

Former Community Member

Hello,

I am creating a form that has a field that aggregates amounts from a table.  What I want to do is make it so the total aggregate will become highlighted once it reaches a certain dollar amount or higher (example: if the total dollar amount of the purchases reaches $300.00 or more, then it will become highlighted).

I need this so people can easily look at this form and if the amount is highlighted, they will know they have to fill out another form for this amount.

I hope that makes sense...

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

I'm guessing you are already using a calculate event, so you should be able to highlight the field in that script, something like;

var result = NumericField1.rawValue + NumericField2.rawValue;

if (result > 300)

{

    this.fillColor = "255,0,0";

}

result;

Just remember that the result of the calculate script is the last value evaluated.

Regards

Bruce

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi,

I'm guessing you are already using a calculate event, so you should be able to highlight the field in that script, something like;

var result = NumericField1.rawValue + NumericField2.rawValue;

if (result > 300)

{

    this.fillColor = "255,0,0";

}

result;

Just remember that the result of the calculate script is the last value evaluated.

Regards

Bruce

Avatar

Former Community Member

That looks like what I want, but when I put your script into the field, it comes up with a syntax error

EDIT: Nevermind the error, figured that out.  Sadly this is what I need, but since it needs to be a Dynamic Form, I guess I can't use it.