Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

How do I add a Message Box if calculations don't match?

Avatar

Level 1

I am developing a form where the user inputs an amount on field Amt, then distributes that amount into up to six "funds" fields (Budget1, Budget2, Budget3...), which determine where the money will come from. I created a screen-only verification field (AmtVerif) that allows the user to see if the divided funds add up to the total shown on Amt.

I want AmtVerif to:

1. add up the amounts on fields Budget 1-6 (which I managed to do using FormCalc)

2. match the total with the entered value on Amt

3. pop-up an error message that says "You went over the total", or "Please verify the allocation of funds" in case totals don't match.

I tried using "if" expressions with FormCalc in the Validate and Exit Events, and although they seem to be correct, they do not show the error message. What am I doing wrong? Please help!

Debora

1 Accepted Solution

Avatar

Correct answer by
Level 6

Please check the attached pdf. script placed on each amount field exit only when entered all of them.

View solution in original post

4 Replies

Avatar

Level 6

Can you post the pdf?

i attached a sample, please check the same.

Raghu.

Avatar

Level 1

Hi Raghu,

Thank you for responding!  I just re-created my fields in the same form you attached, so now you can see exactly what I did.

The last field (AmtVerify) contains the calculation piece, but now I need to match that total with the amount on the first field, and enable the error messages in case it goes above or below the original amount.

Debora.

Avatar

Correct answer by
Level 6

Please check the attached pdf. script placed on each amount field exit only when entered all of them.

Avatar

Level 1

Now I understand what you did - you applied the script to all the numeric fields.

Awesome!  Thank you so much for your help!!!