These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Calculating

Kristin
Registered: Jan 26 2007
Posts: 2

Hello
 
I'm doing a 3 pages form with different calculations, and I can't get it to work. This is my first problem (I use Acrobat 7):
On page 2 I have a column where you add a positive number and withdraw a negative number and get a sum. This sum should automatically go to page 3. If it's a positive number it should go to one column and if it is negative to another.
 
This is the script for the positive value and it doesn't work:
var summa = this.getField("Vinst42").value;
if (summa > 0) event.value = summa;
 
This is the one for the negative value and it works sometimes:
var summa = this.getField("Vinst42").value;
if (summa < 0) event.value = -Math.abs(summa);
 
+300
-500
=-200
 
the -200 ends up in the right place, but the +300 end up in the positive field that should be empty in this case.
 
I don't know anything about Java, can you help me and say what is wrong?

My Product Information:
Acrobat Pro 7, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You're calculation scripts have to also include code for clearing the values. For example, in the positive column

if (summa > 0)event.value = summa;elseevent.value = "";
Thom Parker
WindJack Solutions
[url=http://www.windjack.com]www.windjack.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script