JavaScript Calculator
I have run into an issue, with some of the Scripts, I have several pages, and each page has several text forms that the user can add a number into the field, at the bottom of the page the numbers are totaled into one field and the avg is placed into another. There are 10 pages, that follow this format. On page 11, I pull the avgs. from each page. Placing each of the avgs. in its field, then that number is multiplied, once the number is multiplied it becomes the "Weighted Value." All of the "Weighted Scores" are then added up, to a field named "GrandTotal," the "GrandTotal" is then divided by 100.
The problem I am running into is when I reopen the file I sometimes have to re-enter the Script to make it work. Also after I test the fields, I delete the number from one of the above fields, it zeros out in the results fields and weighted score field, but it leaves a number in the "results field" The code I am using is:
// Custom calculate script
// Get the field values as numbers
var numerator = +getField("GrandTotal").value;
var denominator = 100;
// Calculate and set this field value
if (denominator !== 0) {
event.value = numerator / denominator;
} else {
event.value = "";
}
Any help would be awesome.
