Send this page




Field-naming conventions

by Ted Padova

I couldn’t begin to stress enough the importance of proper field-naming conventions when you create PDF forms in Acrobat. To illustrate how setting up your field names can save you much time, let me offer a few examples.

Figure 1


In Figure 1, you see five form fields used for item totals. Below the five fields you see a field for calculating a grand total. When you open the field properties for the grandTotal field and click the Calculate tab, you can easily sum the five fields with the result appearing in the grandTotal field. Just select the target field (grandTotal) and open the Field Properties dialog box. Click the Calculate tab and click the Value is the sum + of the following fields radio button, then click the Pick button. The Field Selection dialog box opens as shown in Figure 2. Notice that all the field names in this example use parent/child names (total.1, total.2, etc.). To calculate the total for the five fields, I simply click the parent name in the Select Fields for Calculation window. Acrobat automatically sums the fields having the same parent name.

Figure 2


Simple, you say. In this example, yes indeed, it is very simple. But what happens when you have 25 fields you want to calculate and the names are a variety of different sorts? You’d have to scroll through the list in the Select Fields for Calculation dialog box and check every field. This could take some time on a form having many fields.

Another example, and one that can save you much time, is a form like the one shown in Figure 3. I have a form that needs two sets of identifying information. The first set is already populated with fields and these fields use parent/child names. You see field names like client.first, client.last, client.address, etc. The parent name is client followed by a period and unique child names. All the fields were manually created with some unique attributes for fields like text, phone numbers, a combo box for city and country, and so on.

Figure 3


Now, the exact same fields need to be duplicated for the Shipping info area, but of course, the second set of fields needs to have different field names than the Client data fields. Because we named our fields with parent/child names, the task of duplicating the fields is very easy. Here’s how you do it:

  1. Copy all the fields. Click the Select Object tool and press Ctrl/Command + A to Select All, then press Ctrl/Command + C to copy.
  2. Create a new blank document. Press the Shift key on your keyboard and select File > Create PDF > From Blank Page. Note that From Blank Page only appears in the submenu when you press the Shift key.

  3. Paste the fields on the new blank page. Press Ctrl/Command + V to paste.

  4. Edit the parent names. Open the fields palette by selecting View > Navigation Tabs > Fields.

  5. Rename the fields. Open a context menu on the parent name listed in the Fields palette (right click Windows or Control + click Mac) and select Rename Field as shown in Figure 4. The field text box becomes editable. Just type a new name for the parent name. In this example, I use ship for the parent name.


    Figure 4

  6. Copy the fields.

  7. Close the temp blank file without saving it.

  8. Paste and position your second set of fields in the original document. In Figure 5, you can see that the new fields are neatly positioned in the space below the Shipping info head. The fields have names different than the first set of fields, but all the field attributes are matched with the corresponding fields in the Client info area. This kind of procedure can save you mountains of time when constructing Acrobat PDF forms.


Figure 5


There are many more time-saving features you’ll find when using parent/child names. JavaScripts, for example, can be written with much fewer lines of code and the debugging of your scripts will be much easier.

As a matter of practice for all your forms, be sure to get a handle on field-naming conventions and know how to properly name fields.

Are there any times when parent/child names won’t work? Yes! If you create a table using the Create  Multiple Copies menu command (open from a context menu on a field) you should start with a field without a child name ending in a number. For example, you could use client.info as a name, but don’t use client.info.1. When Acrobat creates the table, the child names (in digits) will be added automatically.

Another condition where you won’t want to add child names (in the form of digits) is when creating radio buttons and checkboxes, where clicking one field deactivates all the other fields in a group. For example, using radio buttons for credit card types when a user can only click one button for a single credit card type. These kinds of fields should all have the same name, but different export values.


AcrobatUsers.com  >>  User Groups • News • Events • Articles • Blogs • How To • Resources • Member Log in