I would like to know how to make a calculated total automatically change colour when it hits 100%
Hi,
You want to change the text(textfield values). You have designed your form in LiveCycle Designer. Right.
So, go to the last TextField and select it. Then go to the script section chose calculate event and also chose FormCalc as scripting language not the javascript. Write the below code
if (this.rawValue ==100) then
TextField1.ui.textEdit.border.fill.color.value = "86,155,189";
endif
Regards,
Manjeet
You do not need to use LiveCycle Designer. You can do something like the following as the custom Calculate script:
(function () {
// Add up all of the field values
var sum = +getField("text1").value;
sum += +getField("text2").value;
sum += +getField("text3").value;
sum += +getField("text4").value;
sum += +getField("text5").value;
sum += +getField("text6").value;
sum += +getField("text7").value;
sum += +getField("text8").value;
// Set this field value
event.value = sum;
// Set this field's text color
event.target.textColor = sum == 100 ? color.red : color.black;
})();
Change the field names and colors to suit your needs. You probably want to explicitly round the sum to avoid things like: 0.2 + 0.1 = 0.30000000000000004, which will throw off the check for equivalence to 100 if non-integers are used for the inputs.
Edit: corrected typo
Hi George,
Thanks, this looks like just what I need... can you explain where I put it in Acrobat, you have a novice here : ).
I changed the field names and dropped it into the 'Calculate', 'custom calculation script' box but I see thats not quite right.
Should everywhere you put a // go into a different area?
Thanks for your help
North America
Europe, Middle East and Africa
Asia Pacific