From the course: Acrobat DC: Creating Forms

Prepare fields for calculations

From the course: Acrobat DC: Creating Forms

Prepare fields for calculations

- [Instructor] Another powerful ability of Acrobat DC you can take advantage of when building interactive forms is its ability to automatically perform field calculations. This can really come in handy with documents like order forms, time sheets, or any other file where you might otherwise have to manually add, multiply, or perform other calculations on your fields. Having Acrobat do it instead is a lot faster for both the person filling out the form and the person receiving the form, and it eliminates the possibility of calculation errors. So let's see how to set this up. I've opened up this file called h+ sport order form. It's an order form for a fictitious sports drink company. Now looking at this, we already know how to create fields in this document, so the user can enter their name and address, and so on. What I want to focus on here is the order form section. And all I really want to do here is to create text fields for the quantity and total columns. And as we previously saw, we can probably use Acrobat's form wizard to automatically create these fields for us, since they're all nicely outlined and have column headers. Acrobat should have no problem detecting these fields. But I want to show you how to set this up manually because there are some important things to be aware of that could save you some time later. So I'm going to come up to Acrobat preferences, or if you're on Windows, you'll choose edit preferences. And with form selected, I'm going to uncheck automatically detect form fields. I'll click okay, and then we'll click prepare form. We can see that field detection is off I'll click start, and that again gives us access to our form field tools. So let's select the text field and I'm going to draw my first field under the first cell under quantity. So line that up and just draw the rectangle. And I'm going to name this quantity. Now you may think that we would want to add a number or some other way to distinguish this from the other three quantity fields in this column, but we'll see an automatic way to do that in a moment. First, let's open up all properties. Under appearance, the border and fill colors are already set to transparent, which is what I want in this case because there's already a border and background color designed into this field. I am going to make the font a little smaller though. I'll go with 10, and we'll see how that looks shortly. Next, I'm going to go over to the format tab. And for this format, since I'm looking for a quantity, I'm going to choose number, meaning only numbers will be allowed in this field. I won't need any decimal places because we can only use whole numbers for the number of items to be purchased, so I'll choose zero decimal places. And I don't need to worry about any of this other information below here. Under the options tab, I'll choose an alignment of center. So the numbers will be centered right in the field. Now I plan on copying this field into other quantity fields, so it's a good idea to test it to make sure it looks the way I intended. So I'll close that. We'll click preview and we'll click on that field and I'll type a number. So I can enter numbers, but not letters or any other characters. We can see that the text is centered. And I think it looks okay at this size, so I'll delete this number out of here. And let's go back to edit mode. So now I want to copy this field and paste it three more times into the remaining quantity rows. And we know that you can option drag on the Mac or control drag in Windows to make copies like we've been doing throughout this course. But let me show you another way to do that. I'm going to undo that with command Z or control Z on Windows, and I'm going to right click on this field. And here I'll choose create multiple copies. This opens up a dialog box and I can choose to create copies down, across, or both. In this case, I want to copy the selected field down four times. It counts the original field as a copy, so we want a total of four. And for across, I only want one time, because again, it counts the original field as a copy. With preview checked here, you can see how that will look. I'll click okay. And there are my fields. And notice how Acrobat has named them. It added dot zero after the first field and then dot one dot two, and so on. So each field has a unique name, but you can still tell which group they belong to. If necessary, you can select any individual field to reposition it if the space in between them isn't quite right. So I can select this one and use the arrow keys on my keyboard to move it up or down, do the same thing here, and here as well. All right, so that's the quantity column. Next. I'm going to generate my total fields. Instead of drawing a field from scratch, though, I'm going to option drag or control drag on Windows, the first field to the right, that way I know these fields will have a consistent height between them. And now I can just it's width to fit in the cell. I'll double click it to open up its properties. And under general, I'll name this total. Under options, I'm going to align the content to the right, which is how you normally display numbers in a total column. Under format, this is still going to be formatted as a number, but because we're dealing with dollars and cents, I'm going to allow for two decimal places. I'll leave everything else the same. Now there's one more thing I want to do with this field. The goal here is to set up this form, so the user won't have to perform this calculation themselves. I want this total field to automatically complete itself based on the quantity the user enters in this row. So I'm going to go to the general tab. And here, I'm going to check a read only. That prevents the user from clicking in this field and typing anything in. All right, I'll close the field now. And let's create the copies. I'm going to right click on the field. Choose create multiple copies. Now because this field is the same size as the other total fields, as well as the subtotal tax and grand total fields, I'm going to save some time by duplicating it into all of these fields and I'll just change the names. So I'm going to create seven fields down. and click, okay. And Acrobat copies of names all those fields. So now I'm just going to fix the names of the last three. I'll change this one to subtotal, this one to tax, and this one to grand total. These fields are also going to be read only, and they share all the other properties of the total fields, so I don't need to change anything else here. Now, after duplicating multiple fields, you might find that the positioning starts to look a little bit off, like we have here. And again, if that's the case, we can just select the fields and use the arrow keys on our keyboard to make some adjustments. Okay, so now I've got my quantity and total fields created, but before we start telling Acrobat, which fields need to be calculated together, we need to create a couple more fields so Acrobat knows how much each item costs. And we'll take a look at that next.

Contents