Start learning with our library of video tutorials taught by experts. Get started

Acrobat X: Creating Forms

Introducing math operators


From:

Acrobat X: Creating Forms

with Claudia McCue

Video: Introducing math operators

Acrobat provides some built-in calculation help. I can do the Sum, Product, Average, Minimum and Maximum. When we get to Difference you'll see, well there is sort of a punch line to this. Let me set up the field so they'll do the math. Sum1 and sum2 are going to contain the data that's entered, sum3 is going to contain the total. So in the Text Field Properties, I go to the Calculate tab and I tell sum3 that it's going to be the sum of sum1 and sum2. And click Ok.

Watch this entire course now—plus get access to every course in the library. Each course includes high-quality videos taught by expert instructors.

Become a member
Please wait...
Acrobat X: Creating Forms
2h 27m Intermediate Feb 16, 2012

Viewers: in countries Watching now:

This course demonstrates how to design a form from scratch in Word, Illustrator, or InDesign—or from an existing electronic document. author Claudia McCue teaches how to add interactive fields like check boxes, buttons, drop-down lists, and digital signature fields; how to add field calculations like sum or average; and how to use JavaScript for more advanced calculations. The course also covers how to enable forms for Acrobat Reader users, add security to a form, distribute it via email or the web, and collect data from recipients.

Topics include:
  • Designing forms in multiple applications
  • Creating and editing fields
  • Using auto-recognition
  • Adding buttons and check boxes
  • Creating and adding artwork
  • Performing math in a form
  • Creating an order form
  • Securing forms with passwords and digital signatures
  • Distributing forms via email or Acrobat.com
Subjects:
Business Forms
Software:
Acrobat
Author:
Claudia McCue

Introducing math operators

Acrobat provides some built-in calculation help. I can do the Sum, Product, Average, Minimum and Maximum. When we get to Difference you'll see, well there is sort of a punch line to this. Let me set up the field so they'll do the math. Sum1 and sum2 are going to contain the data that's entered, sum3 is going to contain the total. So in the Text Field Properties, I go to the Calculate tab and I tell sum3 that it's going to be the sum of sum1 and sum2. And click Ok.

And you can already see a bit of the math taking place back here. I am going to finish most of these out and then we'll go back and check the results. Notice that I can talk to a different field without having to hit Close and exit this dialog. I can click on prod3 and now that's a field whose options I am changing. So that's going to multiply prod1 times prod2, so I tell prod3, it's going to be the product of, and I scroll down my list, prod1 and prod2, click OK. You can see it's starting to happen back there.

For the Average, the Value is the average of avg1, avg2, and avg3, click OK. Be thinking, how you might use these math operations in the kind of forms you think you are going to have to build. Minimum and maximum sort of an odd one because you can see everything in front of you and you could pick the minimum and maximum, but there may come a time when this is beneficial for you. I am going to start with minimum and I am going to tell it to examine these fields, minmax1, 2, 3, and 4.

When I close, we'll take a look at the result. Sum is working, Product is working, aren't you glad you learn your multiplication tables, and then for Average, your average is 9, 10, and 11. The Minimum and Maximum, yes it's obvious to us that 29 is the minimum, but again, this may come in handy for you later. Let's do the maximum. I am just going to modify this so that it's now the maximum of, and I still have the same fields picked, so I am ahead with that. Click Close, switch to my Hand Tool, there we go.

I don't know if you noticed, when we are looking at that list of potential math operations, but, there is nothing for subtraction, there is nothing for difference. So this is a bitter shortfall in the built-in math operations. It means that you have to solve this by writing JavaScript. Don't run-away. Don't be scared. Yes, JavaScript is a programming language. I'm not a programmer, but I can do simple JavaScript. And you'll find a number of resources. When you find existing forms that have JavaScript in them, if you think you want to pursue it, I would encourage you to sort of deconstruct them and see how they are built.

And you can copy little snippets and educate yourself that way. So here for my Custom calculation script, ooh, this is so impressive, I click Edit. Here's what I need to do. I need to tell Acrobat, okay I want you to look in the field diff1, store that value, then look in the field diff2 and store that value, and then address this field diff3 and subtract diff2 from diff1. So this is a bit long-winded, but you store the contents of each field and a variable. So I will say variable a=this.getField, odd little phrase, it means in this document, go get this field essentially, diff1, and in case, the name of the field in quotes and parenthesis, and then finish off the line with Semicolon.

In the next line, I tell it to take a look at diff2, so variable b equals this, typing is very important in JavaScript, again open paren and quotes, that's going to be diff2, and again, another Semicolon. And then I tell it to take a look at diff3 and perform an operation in diff3. So variable c=this.getField, yet again, diff3 another Semicolon, and then here comes the math, the c.value, meaning the value of the field that we're identifying as variable c equals open parenthesis, it's going to be the a.value, again this is not a typing class, minus the b.value.

Just to kind of revisit this, yet this is kind of wordy, but when you break it down, it's kind of rational. Hey Acrobat, find out what's in diff1 stored in variable A. Find out what's in diff2, stored in variable B, assign a variable to diff3 just so we can talk to it, and then that c.value is going to be the a.value minus the b.value. So let's see if our programming works. If you've typed something wrong, if you missed to look somehow, you'll get a little error message here, and then it's up to you to go back and sort of thresh it out.

But I got lucky. I had no error messages. When I switch back to my Hand Tool, look it's done the math. Let's make sure that we know it works. We will put something in there that allows us to do math in our heads, and it works, there you go. So if you followed along with me, you've just written your first JavaScript. Isn't that exciting? So those are the simple math operations built into Acrobat and a little taste of JavaScript.

There are currently no FAQs about Acrobat X: Creating Forms.

Share a link to this course
Please wait... Please wait...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.
Upgrade now


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Upgrade now

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Acrobat X: Creating Forms.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Welcome to the redesigned course page.

We’ve moved some things around, and now you can



Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked