Method to detect when a Numeric Field Value Has Been Changed by User

lateniteNC

17-07-2018

I have a complex form that will be used throughout the year wherein the same user will enter data in various tables throughout the form at the end of each quarter. In one column in one table, I would like to be able to tell if an end user has changed the pre-existing values in any of the 25+ numeric fields in one column of the static table. If change is detected, i would like to change the font color.

Changing the color is easy enough, but how to code the changed value of a object is beyond me. Is this even possible in Livecycle Designer? Anyone have any ideas?

Accepted Solutions (0)

Answers (2)

Answers (2)

MinusZero

02-09-2018

You can change the colour of the field with this:

this.resolveNode("NumericField1").fontColor = "255, 0, 0";

But it will change the caption colour as well.

Change just the value with this:

if (xfa.host.version < 😎 {

this.resolveNode("NumericField1").fontColor = "255, 0, 0";

}

else {

var CaptionColorBackup = this.resolveNode("NumericField1").caption.font.fill.color.value;

this.resolveNode("NumericField1").font.fill.color.value = "255, 0, 0";

this.resolveNode("NumericField1").caption.font.fill.color.value = CaptionColorBackup;

}

I tested this in ES2 just using a click event to change the field colours.

lateniteNC

23-07-2018

OK, I have worked out a procedure that will enable me to capture a previous value in another text field. This will enable a comparison; if the two values are not equal, then i will know the user has changed a value.

The field in question is NumericField1. I essentially have 2 dummy fields (CurrentField and PreviousField1) on which I can perform the comparison. if I enter a value in NumericField1, then later change that value, PreviousField1 will capture the previous entry. Thus, if CurrentField1 does not equal PreviousField1, then I know NumericField1 has been changed...and I want that field to change to red font.

My little sample test is found here: Dropbox - Previous Text Test2.pdf

But now I am stumped on how to get NumericField1 to change font color. Any help would be appreciated.