Part 1 of 4: Sample Chapter from "Creating Adobe Acrobat Forms" by Ted Padova
Latest book from author of The Acrobat 5 PDF Bible
18 August 2002
SEE ALSO: Detailed Table of Contents for "Creating Adobe Acrobat Forms" by Ted Padova, and other related files.
Chapter 5: Creating Form Fields
In Chapter 3, "Understanding Field Types," we took a brief look at naming nomenclature for form fields. The importance of using parent/child names was emphasized in Chapter 3. This convention cannot be overly stated and it will be important for all your forms designs to make the best use of field names. For a real-world view of understanding the importance for why parent and child names are used, let's walk through a few examples.
I. Duplicating Fields
If you create fields that have appearances, sizes and other attributes identical for multiple fields on a form, then your construction for fields will be much easier if you can duplicate a field rather than drag open new field rectangles for each common field type. Duplicating fields moves you through the field construction stage much faster than creating each field independently. As an example, assume you want three individual groups of fields for identifying information. One group may be for the information for the user who places an order, the shipping address for the recipient, and the vendor address.
Each group needs a name, address, city, state, zip, and phone number. Rather than create individual fields for each group, you can create a single group, then duplicate it twice for the other two groups. To perform steps in this exercise, open the Doodyville Order Form. The blank form is shown in Figure 5-1. Notice the three areas on the form where identifying information fields need to be created.
Figure 5-1: The Doodyville Order Form requires three groups for identifying information.
- Create a text field for the first line where the name appears. Name the field name.1 in the Field Properties dialog box, as shown in Figure 5-2.
TIP: When you use the Form tool to create a field box and complete setting up the Field Properties dialog box, Acrobat assumes you wish to continue creating more fields and keeps the Form tool active. If you want to create a single field and return to the Hand tool after completing the Field Properties dialog box, press the Ctrl key (Windows) or Option key (Mac OS) before selecting the Form tool in the Acrobat Command Bar. After clicking OK in the Field Properties dialog box, Acrobat selects the Hand tool for you.
Figure 5-2: Create a Text field and name the field name.1.
- Create text fields for each of the other fields naming each field with a parent/child name as shown in Figure 5-3.
TIP: To quickly create new fields, you can duplicate a field and edit the field name. After creating the first field in this exercise, click on the field and press the Ctrl key (Windows) or Option key (Mac OS) and drag down. To constrain movement, add the Shift key when dragging. When the field rests in proper position, press the Enter key on the Numeric Pad to open the Field Properties dialog box. Rename the field by selecting the name and editing the text. Click OK in the Field Properties dialog box.
- After completing all fields in the first group, hold the Ctrl key (Windows) or Shift Key (Mac OS) and drag a marquee through the fields.
TIP: When selecting multiple fields with a modifier key depressed, the marquee does not need to completely surround the fields but needs to pass through all the fields to be selected in the group. Drag the marquee through the fields and release the mouse button. All the fields are selected.
Figure 5-3: Each of the fields in the first group contains parent/child names.
- Press the Ctrl key (Windows) or Option key (Mac OS), click on a field, and drag in the direction where the second group of fields is to be positioned. Note: In this example, the email.1 field was not selected. The fields are duplicated, as shown in Figure 5-4.
Figure 5-4: Hold the Ctrl key (Windows) or Option key (Mac OS) and drag to the area where the second group of fields is to be located.
- The fields are exact duplicates of the first group. These new fields need to have unique names or the data entered in one field will appear the same in all fields with identical names. To rename all fields, keep them selected as a group and press the plus (+) key on your keyboard. All the fields are incremented from the child name. In this example, the names appear as name.2, address.2, city.2, and so on.
Figure 5-5: Select the second group of fields and drag with the modifier key depressed to the third group position. Press the plus (+) key to increment the child names again.
- Repeat the process and duplicate the second group to complete the fields for the third group, as shown in Figure 5-5.
Duplication of fields can only be performed in this manner if the field names contain a child name expressed as a .n (dot-n) in which n is a number. If you name fields like name, address, city, and so on, you would have to rename all the fields individually.
NOTE: The method used for duplicating fields described here only works on individual pages in a PDF file. If you wish to duplicate fields from one page to another, you must use the copy/paste commands or Duplicate menu command described later in this chapter.
II. Calculating on Names
Another reason for using parent/child names is when you want to easily create a calculation. In Figure 5-6, the form has three lines with amounts placed in fields named total.1, total.2, and total.3. A grand total needs to be calculated for the total.
Figure 5-6: The three line items need to be calculated to create a grand total.
If you create a Text field (with Format properties of Number or Percentage) and click on the Calculate tab, then select the Pick button, the Select a Field dialog box opens. Summing data in a column is handled by scrolling the dialog box and clicking on a field, then clicking on the Add button, as shown in Figure 5-7. The steps need to be repeated for every field to be used in the calculation.
Figure 5-7: To sum data in a column, select the Pick button in the Calculate dialog box. Click on each item to be used in the calculation and click on the Add button.
If parent/child names are used, you can simplify the process by selecting sum (+) for the Value Is The pull-down menu and entering the parent name in the field box, as shown in Figure 5-8. Or, you can select the parent name in the Select a Field dialog box, shown in Figure 5-7. In this example, only three fields are used. If the form had a long list of fields, the task would take a little time to pick each individual field in a column. However, when using parent/child names, the process is simplified by adding a few keystrokes in the field box for the Calculate properties or selecting the parent name in the Select a Field dialog box.
NOTE: When you type a parent name in the field box, you enter the name with or without quotation marks. When you revisit a field by opening up the properties after a name has been added, Acrobat places quotation marks around each name in the field box automatically.
Figure 5-8: When parent/child names are used, you can simplify adding fields in a column with a common parent name by typing the parent name on the Appearance tab or selecting the parent name in the Field Properties dialog box.
TIP: When adding columns or rows among fields with parent/child names, it's a good idea to get in the habit of typing names in the field box rather than using the Pick method from the Field Properties dialog box. If you have a long list of fields, it can take a little more time to scroll the box to find each individual parent name. When summing multiple parent names, type each parent name in the field box and separate the names with commas.
Copying and Pasting Fields
Duplicating fields as described above works well when you have fields on a single page and need to duplicate the fields on the same page. If you have multiple pages where fields need to be duplicated between PDF documents, you need to use the copy and paste menu commands. Fields can be copied and pasted on the same page, to different pages in the same document, and between PDF documents.
As you know, fields must have unique names when data are to be entered in rows or columns and their results need to be unique. In some cases, you may wish to have identical field names to exchange data between PDF files. An example where unique names might be used is when you have identifying information that remains consistent between documents. For example, suppose you have a Human Resources department using PDF forms. All the employee identifying information, such as name, address, phone, emergency contact, and so on might be used in part or in total on performance evaluations, tax forms, pension plans, job descriptions, and so on. Rather than typing the information on each separate form, you can import data into a form. The main requirement for importing data is all form fields must be named exactly the same including case-sensitivity.
If you design forms independently, creating new form fields each time a form is designed, you run the risk of making mistakes with field names. A typo, forgotten letter case, forgotten nomenclature, and so on can cost you time when debugging the form. A much better method is to use the copy and paste commands. When a field is copied, the field names and attributes reflect a carbon copy of the original. When pasted into the destination form, you can be certain all fields match each other exactly.
In Figure 5-9, a file is used to store customer identification information. To copy fields, select the Form tool and press the Ctrl key (Windows) or Shift key (Mac OS) and drag through the fields to be copied. Right-click the mouse button (Windows) or Control+click (Mac OS) to open a context menu. Choose Edit > Copy. The fields are now copied to the system clipboard.
You may wish to keep the file open from where the fields are copied in the event more fields need to be copied or a mistake was made by not selecting all fields to be pasted. In this regard, leave the file open and choose File > Open. Open the file where the fields need to be pasted and choose Edit > Paste.
NOTE: Pasting fields can be handled in a context menu only when a field exists in a document and a field is selected. If you try to open a context menu without a field selected, Acrobat won't know you want to handle menu commands respective to fields options. The menu options from context menus on document pages with nothing selected only support navigating and searching the document. When using menu commands for managing fields, always be certain to first select a field with the Form tool before you open a context menu.
Figure 5-9: Select all fields you want to copy and open a context menu. Choose Edit > Copy to copy the fields to the system's clipboard.
When the fields are pasted, you may need to move them around the page. You can move fields by clicking on one of the selected fields in a group and dragging around the document page. You can nudge fields into place by striking the up, down, left, and right arrow keys. The fields move respective to the direction of the arrow keys.
If you need to return to the original file, choose Window > filename where filename is the name of the file where the fields were copied. Select additional fields in the same manner and copy and paste them into the destination document. When the fields are positioned, they are ready to be filled in, as shown in Figure 5-10. Data can also be imported from forms where the field names have identical matches.
[CONTINUE to Part 2 of 4]