Hello,
One option is to make the calculation of grand total in the Initialization script as follows.
Go to the Advanced properties of your form > More options > Scripts and in the Initialization section set Type to Custom. In the code area that appears put code like this:
function ff_FORMNAME_init()
{
setInterval('calc()', 500);
} // ff_FORMNAME_init
function calc() {
var grandsum =
Number(ff_getElementByName('firstField').value) +
Number(ff_getElementByName('secondField').value) +
Number(ff_getElementByName('thirdField').value);
ff_getElementByName("Grand_total").value = Number(grandsum).toFixed(2);
}
NOTE: In the code above, replace
FORMNAME with the name of your form.
Also, replace "firstField", "secondField" and "thirdField" with the Names of the fields that should be included in the calculation.
Another option is to add this line of code to the Actionscript of EACH element whose value is included in the calculation:
In the "Grand_total" field you would have to put code like this:
function ff_Grand_total_action(element, action)
{
var grandsum =
Number(ff_getElementByName('firstField').value) +
Number(ff_getElementByName('secondField').value) +
Number(ff_getElementByName('thirdField').value);
ff_getElementByName("Grand_total").value = Number(grandsum).toFixed(2);
} // ff_Grand_total_action
NOTE: In this code, it is assumed that the name of the total field is "Grand_total".
The code provided also rounds the total number to two decimal places.
Let me know whether you have managed to apply this to your form.
Regards,
Mihaela