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

Forms refuse to calculate

gedeyenite
Registered: Mar 14 2008
Posts: 10

Hey all, first post.

I have self-educated myself into creating forms with AA8Pro. I have created forms with formulas (built and complex ones) that work fine when "previewing" them. However, when I save them, with properties to allow Reader users to save them, they do not act properly.

Calculation fields refuse to calculate. For example: If I make fillable form where field A and B are number fields, entered by the user and Field C is a calculation field where C=A+B it refuses to autofill in the result! If I open the form back up in Pro, and retype the formula, it will work that one time, but if I open the form back up in Reader, no auto-calcs! I have checked the setting in Reader to "calculate fields" which is actually that way by default, but that doesn't seem to help.

This is frustrating since it obliterates the usefullness of creating Adobe Forms for my workplace.

I even download the sample expense report from this site and it did the same thing.

Ideas?

iMac
Acrobat Pro 8

My Product Information:
Acrobat Pro 8.1.2, Macintosh
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Form field calculations should work fine in Reader without "Reader Enabling". For your forms, do they work in Reader if you do not apply "Usage Rights Enabling"?

From what you describe, it sounds like the forms do not have the calculation scripts on them at all, after the enabling. Can you post the form to somwhere it can be downloaded from?

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

gedeyenite
Registered: Mar 14 2008
Posts: 10
1) http://img.skitch.com/20080317-p53pbyy7hyxctu5e7bsskgm3ph.jpg
2) http://img.skitch.com/20080317-kx3gfb8bnf6scxr3ird8wbkk7j.jpg
3) http://img.skitch.com/20080317-d9pi3bdjesyitkgnn458rw7bt5.jpg

I will have to work on a place to upload this form. I don't think I can do it from work due to "storage" website blocks.

Murph
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The last screen shot is the critical one. To work with the canned and simplified notation, the field names cannot contain ".", and it is especially bad form to use ".0", ".1", etc. postfixes in field names.

I know, I know, some built-in Acrobat processes generate fields with these kinds of names. But whoever wrote those was wrong, and not in sync with all the other form field stuff that was going on in Acrobat. So don't do it!!

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

gedeyenite
Registered: Mar 14 2008
Posts: 10
Could there be another reason? I know I tried to make one previously that did the same thing...would not autocomplete. Let me see if I can dig it up...
...found one.

1) Here it is not working in Acrobat Reader: http://img.skitch.com/20080317-rj9p3jyr7my8kk7kyt6gqnbwmn.jpg

2) Here is the syntax for my formula. I based the formula on samples I found on the internet...and this is probably where I am going wrong.
http://img.skitch.com/20080317-d2gqjwgcu4f3r5r254dwu17j2s.jpg

3) I have also tried something more simple, but with the same results...
Formula: http://img.skitch.com/20080317-3usffjbgtcdsbr4exbg6ewd1e.jpg
Result: http://img.skitch.com/20080317-8rm8jdcyu7nagsbphp2jst66cc.jpg

Thanks for all the help.
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
I believe this is an issue with the more recent versions of Acrobat. I have found that the newer versions of Acrobat do not end the internal code with a new line and the JavaScript engine hangs because it does not realize it is at the end of the line. Sometimes opening the calculation tab and clicking on the "Custom calculation script" option will allow editing of the autogenerated code and one can and the new line to the end of the code.

I have also seen this issue when addig field with associated JavaScripts in PostScript files using the PDF Mark statements.

You could try the following script: in the "Custom Calculation Scirpt:"

AFSimple_Calculate("SUM", new Array ("food.0", "hotel.0", "other.0"));
//

and then change the "0" to the correct row.

George Kaiser

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The code for your calculations is fine. Nothing wrong there.

Obviously a calculation is taking place, but the wrong numbers are popping up. Have you checked the calculation order? This can cause the results you are seeing. Is there anything else on the PDF (other code) that could be interfering with the calculations?

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

gedeyenite
Registered: Mar 14 2008
Posts: 10
Here is the trouble file:

http://www.filedropper.com/4092/oer-note-cg
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
It's very difficult to see what's going on with this file since it has Reader Extensions applied to it. Please resubmit without any protection or enabling.

I was able to confirm that it's not performing any calcualtions at all. But for what reason, I cannot tell.

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

gedeyenite
Registered: Mar 14 2008
Posts: 10
To be honest, I have no idea where those settings would be turned on or off.

In "Simplified Field Notation" this is my code:

(ACOM / (ACOM + COM))
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
I was able to look at the script and everything appears to be correct. I actually went in and changed the calculation and put some debug code in it. That's how I know that it doesn't execute at all.

However, "Reader Extensions" have been applied to it. This happens automatically when the "Distribute Form" option is used on the "Forms" menu. I suspect that maybe this is what happened. Unfortunately you cannot turn Reader Extensions off. Do you have the original file somewhere?

The form itself is very simple, so one approach to fixing it would be to simply recreate it.

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

gedeyenite
Registered: Mar 14 2008
Posts: 10
I created the original. I can try it over. I don't recall using distribure form on this one but I might have clicked it. I will redo and send you the results.

Thanks for helping out a n00b.
nbettencourt
Registered: Dec 31 2008
Posts: 8
I am having the same difficulty.

Scenario: I have 6 class options available. Interested students can take (for the purpose of this discussion) 1 - 6 classes. Each class has a checkbox next to it, let's call them CheckboxA - CheckboxF. Field1 should be the sum of all the checked boxes. Field2 = Field1 * 115 (at $115 per class, Field2 calculates total tuition due).

Attempt 1: Each checkbox was set to an export value of 1. Field1 was calculated as the sum of CheckboxA + CheckboxB + ... + CheckboxF. Field2 (using Simplified Field Notation) was calculated as Field1*115. This worked great in Acrobat 8 Pro, but the fields would not calculate in Reader.

Attempt 2: Checkboxes were left as they were. After hours of digging through forums & grabbing what bits of JavaScript I could find, Field1 was then recalculated through a custom script (Note the field names below are what the checkboxes are actually named):
var sum = 0;
if (this.getField("Core1").value !== "Off")
sum += 1;
if (this.getField("HP1").value !== "Off")
sum += 1;
if (this.getField("Gas1").value !== "Off")
sum += 1;
if (this.getField("Core2").value !== "Off")
sum += 1;
if (this.getField("HP2").value !== "Off")
sum += 1;
if (this.getField("LtRfg1").value !== "Off")
sum += 1;
event.value = sum;

(frickin pain in the ***.) Anyway, that worked, but now Field2, which should not have been affected, would not work. So I went in and just retyped it with some additional spaces, so now it equals Field1 * 115. That worked too. Until I opened it in Reader. Fields 1 & 2 just will not calculate. Please help!(Also, have no idea if this is at all related, but the TouchUp Text tool does not work at all now. It did before sporadically if I tried again & again, but I have not been able to get any results in the last 15 attempts, so I think it's dead now. The TouchUp Text Tool is not the subject of this discussion, I only bring it up in case it is related in some bizarre way.)
nbettencourt
Registered: Dec 31 2008
Posts: 8
Forgot to mention: have definitely not hit "Distribute Form." Have sent it to myself as an email attachment, though.
George_Johnson
Online
Expert
Registered: Jul 6 2008
Posts: 1876
Have you confirmed that the field calculation order is correct? Can you post the file so we can take a look at it?

George
nbettencourt
Registered: Dec 31 2008
Posts: 8
Funny. Now the calculations don't work at all, not even in Pro. The only thing that has changed in this file since my last post (I think) is when I was cleaning out all the different versions, I threw it in the trash & then recovered it. And I would love to post the file. How do I do that. Hmmm, let me try & just copy & paste it into the body here, see if that works: . Nope, didn't work. How do I stick an item or attachment into this forum?
George_Johnson
Online
Expert
Registered: Jul 6 2008
Posts: 1876
Unfortunately, you cannot upload files here. If you can post it on another site (do you have a web site), that would work if you provide the link. Otherwise, I'd be happy to take a look at it if you can send it to me by email.

George
nbettencourt
Registered: Dec 31 2008
Posts: 8
Here's what I've done: Before posting, I tried & tried to get things to work, including the formulas & the TouchUp Text tool, and my eyes were hurting & I was tired & frustrated. I did not want to re-create the PDF from the original Word document because I has already spent all this time renaming my fields, and determining the calculations. I was going to post & wait for someone to help, but after posting, I could not walk away and not have answers, so I went back to the drawing board.I re-created my form from Word, did NOT enable user rights, renamed all my fields, copied the formulas from the old form to the new form, and everything worked perfectly, in both Pro & Reader. Even the TouchUp Text Tool worked. I then saved a different copy, enabled user rights in that as my very last step, and everything continued to work perfectly.As much as I would really really like to know what was wrong with the old form, I don't want to take up more of your time when my problem only exists in the curiosity part of my brain, and there are others out there who need real help. And my guess is that enabling rights somehow interferes with basic form processes, and that is what was messing with both the formulas & the TouchUp Text tool. That's just my personal theory, but definitely my working guideline for the future is this: Create your form, save a copy, and as the VERY LAST step, create a new copy with User Rights Enabled.