LiveCycle Designer dynamic form/table with repeat rows and calculated total in footer - need code to turn total red if <>100, black if =100



I have a dynamic form with a table that uses a button with an instance manager to add rows and another to delete rows. The footer row has a field that calculates the total of fields in the rows above, and changes as the user enters entries, add/removes rows, changes entries.

I would love to turn the text of the calculated total to red if it is <> 100, and back to black when it =100.

I've tried all sorts of code in all sorts of events. Sometimes I can get the calculated total to turn red -- but the calculation won't work and it displays as zero. Mostly I just break the calculation and nothing happens at all after that.

Name of field where user enters a number that is totaled in the footer row:


Name of field where total is calculated


Code to calculate the total:

::calculate - (FormCalc, client)


This works fine to calculate the total in the footer. What code will change the font of that total to red if it is <>100 and back to black if it is =100, where do I put it, and is it JavaScript or FormCalc?

Accepted Solutions (0)

Answers (2)

Answers (2)




Change the calculate script in the following way:

::calculate - (FormCalc, client)

var s = sum(TableREPEATROW[*].UserNumberSubform.UserNumberNumericField[*])

if (s eq 100) then

    $.font.fill.color.value = "0,0,0"


    $.font.fill.color.value = "255,0,0"


$ = s