Hi,
You could put similar javascript in the exit event of TOTALALLO field:
var vName = this.somExpression;
var fieldObj = xfa.resolveNode(vName + ".ui.#numericEdit.border.fill.color");
if (this.rawValue > ALLOTEDOCIE.rawValue) {
fieldObj.value = "255,225,225";
}
else {
fieldObj.value = "225,255,225";
}
/* Check the type of object and change the .ui reference:
Date field = #dateTimeEdit
Dropdown = #choiceList
Checkbox = #checkButton
Text field = #textEdit
Numeric field = #numericEdit
*/
Note this is based on TOTALALLO being a numeric field. If it is a text field then you will need to change the ui reference to "textEdit".
Also you will need to apply a solid colour to the field (at design stage) If the field does not have a background fill then you cannot change it with script. To apply a background colour; select the field and go to the Object / Field tab. Select custom in the Appearance drop down and then in the window select solid for the fill. You can select white for the background fill colour.
Lastly the script above just looks at the values and turns the field red or green. You may wish to extend the script to change the background back to white if the field is null.
Good luck,
Niall