Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

How to do math in forms in Designer

Avatar

Former Community Member
using Acrobat Pro 8.1.2



I'm trying to turn a paper form (already in PDF format) into a fill-out-able form with fields, some text, some numerical, some containing very simple formulae.



I've tried to create it in Designer and ended up hopelessly lost when trying to figure out *how* to put the formulae in the appropriate form fields.



Here's an example of what I need to do:



Total = field1 + field2 + field3



...and so on, max fields being added is 7 or 8.



Nothing fancy, nothing complicated, the fields are 1 or 2 digit values, and it needs to update the total if any of the variable fields' values changes.



I've tried following through the rather arcane help file, and only ended up confused and irritated.



Help????
7 Replies

Avatar

Level 2
You would type in the script field:



sum(field1)+(field2)+(field3)



Make sure that you are using the script in FormCalc and that the calculate button is shown on the field to your left of the script field.

Avatar

Level 7
In LiveCycle Designer's menu bar look under the "Help" option there should be a "Scripting Reference" that includes information about entering scripts. Also there are many predesigned templates that have examples of calculation scripts. There are also on demand eSeminar videos on the Acrobat Users Community site, http://www.acrobatusers.com/ .



You can also use the "Sum()" function to add a series of fields:



Sum(field1, field2, field3)

Avatar

Former Community Member
Kim said:

>You would type in the script field:



>sum(field1)+(field2)+(field3)



What I've actually got is:

field1 field2 field3 field4



fields 1, 2 and 4 get user-entered values, field3 is the sum of them.



>Make sure that you are using the script in FormCalc and that the >calculate button is shown on the field to your left of the script >field.



I've got it set for FormCalc, but I have no idea what you're talking about with the calculate button???

Avatar

Level 7
The function name is "Sum()", all function names, methods, field names, etc are case sensative.



Try the following in the "Calculation" script section of field3:



Sum(field1, field2, field4)



You want all the field names within the parameter list for the Sum function so empty or non-numeric fields are treated as being zero and not undefined or anything else.

Avatar

Former Community Member
Sorry to seem(?) overly dense, but just exactly *how* do I enter this:



>Try the following in the "Calculation" script section of field3:



>Sum(field1, field2, field4)



I have NO idea where I'm supposed to put this. Does it somehow go in the Palette, or what???



What if I were to re-create this document in Excel (with which I'm a LOT more familiar), complete with all the formulae I require - is there a way to import it "lock, stock, and barrel" into Acrobat and thusly kick out a properly-working document???



I'm really stumped!

Avatar

Level 7
Have you looked at the eSeminars on demand I have linked to or the "Scripting Reference" under LiveCycle Designers help?



You have to have the "Script Editor" open in LiveCycle Designer, and select the "text3" field, set the binding for this field as "read only, calculated", and cut and paste the script into the "Calculation" event for the "text3" field.

Avatar

Former Community Member
Brian, send me an email and I'll be happy to help: gretchen.payne@wch-rcc.com