Simplifying Form Field Duplications
I’ve been gearing up for the Acrobat Central Conference being held in Council Bluffs, IA on October 23 and 24 for several weeks now. I needed to do an overhaul on all my demo files, so it’s taken me several weeks to prepare for my sessions and workshops.
Of all the tips and techniques I use in my upcoming speaker sessions, my favorite is simplifying field duplication on Acrobat forms. I thought I’d give a preview here on Acrobat Users for those who can’t make the conference.
Let’s take a look at the form shown in Figure 1. It’s a rather simple PDF form with not many fields and it wouldn’t take much time to manually create the fields on this form. However, we can cut our time down a little by using the method described below. On this form, I’ve already created some fields for the identifying information at the top of the form as you can see in Figure 1.
Notice under Emergency Contact Info you find an identical set of fields as the fields shown in Figure 1. To speed up my work in Acrobat and make it a little easier to create my fields, I’ll just duplicate the fields in the top section and add the duplicates to the bottom portion of my form.
But wait you say… the fields need unique names in order to accept unique data. And, of course, you’re correct. So our task is to copy the existing fields and paste in fields with different names. Here’s how we do it:
- 1. Open the Fields panel (you can choose View > Navigation Panels > Fields or open a context menu on a Navigation panel icon such as the Bookmarks icon and choose Fields from the menu)
2. When the Fields panel opens, this particular form shows me two field names. The employee field name is a hierarchical name. My actual fields on the form are employee.first, employee.last, employee.address, and so on. If I rename the parent name, all my fields will keep the same child name while taking on the new parent name. In this example, I’ll use emergency for the root name so my fields will hence take on names such as emergency.first, emergency.last, emergency.address and so on.
To rename the fields, open a context menu on the name you want to rename in the Fields panel and choose Rename field as shown in Figure 2. Type a new name and all the fields with the same parent name are changed.
3. Copy the fields. Use the Select Object tool and select all fields you want to copy, then choose Edit > Copy or press Command/Ctrl + C.
4. Revert the file. We just temporarily changed the field names in this file. We still need the original field names on our form while adding all the emergency field names. The original names are on the original file and the new names are on the Clipboard. Choose File > Revert and you get back the original unedited document.
5. Paste the new fields. Once again, on the Clipboard are all the renamed fields. Choose Edit > Paste or press Command/Ctrl + V and the fields with the new parent names are pasted into the document.
One word of caution: be sure to have the Select Object tool active when you paste fields into a PDF document. You can easily click and drag the selected fields around the document page. If the Hand tool is selected when you paste the fields and you click the Select Object tool, you loose the field selections. This could make it difficult to select the new fields scattered around the existing fields you don’t want moved. Don’t bother locking the fields. You can still copy and paste locked fields.
6. Click and drag the fields to position. In Figure 3 you can see my final result. The employee fields are at the top of the form and the emergency fields have been moved to position at the bottom of the form. The fields have identical attributes for the common fields such as formatting for phone numbers and a Combo box for choosing the state name.
Figure 3
Download the Sample Form. File size is: 362K
Let’s take a look at another example and a little twist using a similar method. In Figure 4 you see a multi-page form with fields created on page 2. Following this page I have 3 more pages requiring the same fields in the same locations. If these were all user input fields with no calculations, I could use the same method described above. However, there are a number of JavaScripts and field calculations on this form. My needs are to not only rename the fields for the other pages, but also edit the JavaScripts. Once again, I was certain to use hierarchical names. The field names for Budapest all begin with b. I also have a form for Chengdu, Sweden, and Hawaii. Therefore, I’ll want my parent names for these pages to be c, s, and h respectively.
I wrote an article describing this method stressing the importance for using hierarchical names. You can find my Field-naming conventions article here on Acrobat Users. Some of what follows is a repeat of a similar method, but here I add a little more for why you might choose to create a temporary work file.
Here’s how to tackle this job:
-
1. Create a blank new page. Choose File > Create PDF > From Blank Page. We need to create a temporary work file to perform the following steps. You can learn more about creating blank new pages from Donna Baker’s nice article for Starting fresh: Creating a new PDF file.
When you create a blank new page, Acrobat assumes you want the page used for a memo or note. The new page is fine for adding text as pointed out by Donna in her article. But, we’re using our temporary file for form fields and we don’t have any need for the text box or the fonts loaded when the new page is created.
2. Save the blank page. Choose File > Save As and save the blank page. Close the file. When you save the file, you eliminate the annoying text box.
3. Reopen the blank page. Just open the File menu and you’ll find your last saved file at the top of the Recent Files list.
4. Copy the fields you want to rename and paste them into the new blank page.
5. Rename the fields. Again we use a similar method for renaming the fields. Open the Fields panel and open a context menu on the parent name for the fields you want to change. Choose Rename field from the menu and type a new name. As I said earlier, I’m changing my b name to c and all the children for that name are renamed. I also have a name used as b.budapest. I’ll change that to c.chengdu and all my fields are named for the Chengdu page.
6. The next step deviates from the first example. We need to take care of all the JavaScript calculations. To do so, I can edit all the scripts in my new blank page with my new fields. Choose Advanced > Document Processing > Edit All JavaScripts. The JavaScript Editor shown in Figure 5 opens. All I need to do is change all the occurrences of b to c and b.budapest to c.chengdu and the scripts will be calculated properly for the fields on this page. I have a few additional fixed values, and I’ll change those as well.
7. Copy the new fields after editing and paste them on your form. To continue, I follow the same procedure for the remaining pages in my form.
You could avoid using a temporary work file, but the more JavaScripts you have in a document the more searching you’ll have to do to make the proper changes. By isolating the scripts in a temporary file, you’ll find it much easier to locate the field names you need to change.
Try practicing on the Sample PDF file and let me know if you have any problems. File size is 6MB.
ted
January 3rd, 2008 at 4:43 pm
Hi Ted,
Happy New Year first to you and to your family!
When I open the Travel brochure (Travel this summer) you have apply a different background colour for screen view.
How you can accomplish this one?
I can not find any script into your brochure about background colour…
Thanks for your great as always tutorials.
They are BIG,BIG help for all of us-Thanks
January 3rd, 2008 at 10:43 pm
Hi Patra,
Happy to hear that some of the tips work for you.
I’m not sure exactly what background color is changing. The file download is a document converted from Adobe InDesign with background elements added in the layout. There isn’t anything in Acrobat set up to change the background color. Perhaps if you let me know a little more about what you’re seeing when you open the file I might be able to add another comment.
Regards,
ted
February 28th, 2008 at 12:11 pm
motorola v3 ringtones info motorola remember ringtones v3 motorola v3 mp3 ringtones…
Any number of lg phone ringtones new ringtones…
March 7th, 2008 at 9:51 am
go phone ringtones…
As free i730 motorola nextel ringtones mobile ringtones yahoo…
March 7th, 2008 at 1:12 pm
advance cash overnight advance cash loan overnight overnight cash advance…
It seems 0 advance card cash credit free motorola v3 ringtones…
March 7th, 2008 at 1:42 pm
cash advance service…
Turn cricket wireless ringtones cell free phone ringtones samsung…
March 11th, 2008 at 10:00 am
advance cash on line advance cash line loan…
Recently free christian music ringtones advance cash loan loan payday…