Copy link to clipboard
Copied
As I read the various forums, it looks like many users struggle to create fast PDF Fillable documents when there are many calculations in play. It too have the same issue. If there are more than 10 calculations or so in a PDF, it becomes so difficult for users to use the PDF.
Option 1:
One community member suggested eliminating calculations in fields. Instead, they suggested creating a button that calculates all fields at one time and sends the data to the relevant fields.
Option 2:
Someone else suggested somehow using validation scripts vs calculation scripts.
I would greatly appreciate just even one code block for either option above to get me started. Once I see the javascript for one calculation, I think I can do the rest.
Here is a DropBox link to the document. It is also attached below. You'll see there are 2 columns of 30 rows each that have calculations (read only fields). And, you'll see the totals at the bottom row (also each calculating).
Thank you for any advice.
Copy link to clipboard
Copied
All you have to do is apply the calculated value to that field's value property, like this:
var v = 12 * 23;
this.getField("FieldName").value = v;
Of course, the "v" variable can include the value of a field in its calculation. This is just an example.
Copy link to clipboard
Copied
You can move all the code to a single field's calculation event, and then you would only have one calculating field, instead of dozens.
Also the way you're performing the calculations can be improved. For example, you calculate the TotalCalculated.1 field using this formula:
AdmissionFee\.1+LOCAmount\.1+RentCollected\.1
And then TotalBonus.1 with this one:
[AdmissionFee\.1+LOCAmount\.1+RentCollected\.1]*.04
This is just performing the same calculation twice.
Instead, the second formula should be:
TotalCalculated\.1*.04
Of course, then you have to make sure that the TotalBonus fields are calcuated after the TotalCalculated fields for it to work correctly.
Copy link to clipboard
Copied
@try67 Great. I like that. Rather than needing the user to remember to click a calculate button, I can just have all the calculations done in one field.
@JR Boulay @try67 : The thing I don't know is what is the actual code is to print the answer in another field.
For instance, if I place a division calculation in a box we'll call TEXT47 along with other calculations, how do I get it to show the division calculation over in another read-only field we'll call TEXT100.
Do I use some sort of print function?
If one text box is calculating dozens of fields... how do I sent the results of those calcuations to the proper fields?
Copy link to clipboard
Copied
All you have to do is apply the calculated value to that field's value property, like this:
var v = 12 * 23;
this.getField("FieldName").value = v;
Of course, the "v" variable can include the value of a field in its calculation. This is just an example.
Copy link to clipboard
Copied
YOU ROCK! THANK YOU!
Copy link to clipboard
Copied
@try67 With your help, I was able to move 60 calculations into one calculation field. (See attached.)
However, it still has that silly lag time as the user tabs over from one field to another. It feels a little faster. But, wow, I am so surprised that Adobe designed these forms this way....
I may try to create a calulation button after all. At least the user can get all their input into the form easily and then just click calculate.
If you have any additional wisdom before I do that, much appreciated.
I learned a lot from your help today!
Copy link to clipboard
Copied
You don't have to tick each children field for calculation, just tick the parent field.
Two pictures are better than 2000 words:
Copy link to clipboard
Copied
@JR Boulay Okay, so this is amazing. This would have saved me so much trouble over the last dozen forms I have created. My goodness. THANK YOU.