# Forms

Currently Being Moderated

## How do I calculate averages in a form?

### Sep 13, 2012 6:15 AM

Hi All,

I'm throwing myself on the mercy of the forum.

I'm new to form building and I don't know javascript.

I'm working on a form and I can't seem to get it right.

When I first enter values it seems to be working, but if I make corrections or changes the calculations go bad.

I'm sure there is an easier/better way to calculate averages in a form.

I think I need either a calculate/re-calculate button, or better javascript that processes the math line by line.

I'm getting too close to the deadline to keep futzing around with it.

Would anyone care to have a look at my form and help me?

Here are the details...

I'm using Acrobat 9 Pro

I'm using a Macintosh running OS X (10.7.4, Lion)

Teacher Evaluation Form:

Teachers demonstrate proficiency in four domains.

Evaluators assign scores (-, N, 0, 1, 2, and 3) to a number of items in each domain.

N indicates the item is Not Applicable.

A dash - indicates a score hasn't been given yet.

Each domain has a weight value to be calculated into the final score.

My job is to create a form that calculates the raw average and the weighted score for each domain, then a total for the performance evaluation total.

What I did.

I created:

A drop down field to score each item under each domain.

A hidden field that decides if the field for each item has a true number or another character.

A hidden field that sums the scores of all the items in each domain.

A hidden field that sums the number of fields that have a numeric value.

A field that divides the total of the values from each domain and divides it by the number of of fields with numeric values to get the raw average.

A field that multiplies the raw average by the appropriate amount to get the weighted score for each domain.

Finally, a field that sums the weighted scores to produce the final evaluation total.

Again, it seems to work at first, but if any changes are made to the scores the math goes bad.

Here is a download of the form with all the hidden fields visible so you can see what is happening.

https://dl.dropbox.com/u/783012/2_Evaluation%20Form.pdf

Replies
• 9,224 posts
Aug 11, 2002
Currently Being Moderated
Sep 13, 2012 10:03 AM   in reply to ScaryHouse

There are several problems with the calculation script for the "Test Total" field. Be sure to have the following user preference set: Edit > Preferences > JavaScript > Show console on errors and messages.

Also check that the field calculation order is correct.

|
Mark as:
Actions

#### More Like This

• Retrieving data ...

#### Answers + Points = Status

• 10 points awarded for Correct Answers