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

Error in calculation in Adobe 8 Pro

jherring
Registered: Aug 6 2009
Posts: 13
Answered

I have created a form with simple javascript calculations which, when tested, worked fine. I enabled the form and sent it to the user. When the user entered numbers into the form, the calculations did not work properly. I took the form back and double-checked my coding, and it was correct. As soon as I re-entered the formulas, the calculations were accurate. I re-enabled the form and the calculations were now inaccurate. This happened over and over again, and in more than one calculation field. Is this a known issue with Adobe 8 Pro? Am I doing something wrong? Any thoughts?

My Product Information:
Acrobat Pro 8.1.3, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Be more specific about what is going wrong, please. And also share the file in question with us, if you can.

Also, which version of Reader is your user using?

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

jherring
Registered: Aug 6 2009
Posts: 13
I will attach the file so you can see. But question: How do I attach a file to this post?
try67
Expert
Registered: Oct 30 2008
Posts: 2398
I don't think you can. But you can upload it to adobe.com or a site like rapidshare.com and then post the link here.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

jherring
Registered: Aug 6 2009
Posts: 13
The file in question is posted here:

http://rapidshare.com/files/264799648/Rhodes_Contract_Rev_NE.pdf


The errors are intermittent and usually occur in the "Tip" row. The errors occur when I use the form in Acrobat 8 Pro, and my user is using Acrobat 9 Pro. But it also happens in Reader 9. Totally not selective! Thank you in advance for your help.
try67
Expert
Registered: Oct 30 2008
Posts: 2398
In the Custom calculation script of the Tip field you have an error in the following line:
var b=this.getField("Tip Percent");

There's no field called "Tip Percent". Only "TipPercent" (no space).
Fix that and the rest seem to work fine.

P.S. - in the future, use more descriptive variable names. It will make it easier to debug.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

jherring
Registered: Aug 6 2009
Posts: 13
I fixed those errors and it will calculate properly -- but only one time. After the proper calculations, if I change the input data (number of guests, amount for fees, etc.), the numbers may -- or may not -- recalculate.

I've uploaded two examples (not in editable form). In the first example, the tip row is not calculated at all, all the way across. In the second row, the tip row is calculated. The only thing I did to the actual form was open up the calculations edit box and close it again -- I made no changes to the formula -- and it calculated.

Also, what did you mean "use more descriptive names for variables?" Do you mean instead of "a" or "b", I can use "var.tip" or "var.guests"? That would definitely make it easier.

http://rapidshare.com/files/264807862/Rhodes_Contract_Rev_NE_Example1.pdf.php

http://rapidshare.com/files/264808195/Rhodes_Contract_Rev_NE_Example2.pdf.php
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
You need to set your field calculation order in the correct sequence. For example you 'Tip" field is the 3rd from the last calculation performed. So the tip value is not being included in the 'TipTotal' field that has already been calculated. If you put '0' in the Guest field, the form information will not change, but the form will recalculate correctly since none of the base calculation values will have changed, but the correct values will have been used.

George Kaiser

jherring
Registered: Aug 6 2009
Posts: 13
I took all your suggestions and completely re-entered the form. It works! Thank you so much for your help. I'm now a believer!