Mapping fields

We have already installed the PDF Forms Filler for CF7 plugin and attached a PDF file with a form. We are now ready to create a form on our website that users can fill out and receive a completed PDF (by email or download). We will need to create CF7 form-tags and map them to fields in the PDF form.

We will use the following demo PDF file.

Image 1

How to map CF7 fields to PDF fields

Open the tag generator window by clicking the “PDF Form” button. In the Field Mapper Tool section you will see two dropdown lists: CF7 field/mail-tags and PDF field.

What’s in the PDF field dropdown

The PDF field dropdown contains a list of form fields that exist in the attached PDF file.

Image 2

At the end of the list, you will see duplicate field names with a numeric [ID] in front of the field name. The [ID] fields are tied to specific PDFs. The fields without [ID] are applied to all attached PDFs. Because multiple PDF files can be attached to a single CF7 form and different files can have the same field names, the same mapping can be used for multiple files.

When you set up the field mapping you can choose which file and field to apply the field mapping to. If you select a field without [ID] then field mapping will apply to all PDF files with the same field name.

If you need to send different versions of the filled PDF file to the user and the administrator then you should attach the same PDF file twice and map CF7 fields to PDF fields named with [ID]. You will also need to use the checkbox settings Attach to primary email message and Attach to secondary email message in the options of each file.

Use field mapping with [ID] only when you really need it. If you delete the PDF attachment then all field mappings associated with the attachment by [ID] will be deleted.

If you need to replace your PDF file with a newer version, please replace it on the server directly (via FTP/etc), do not detach it from your CF7 form, otherwise the field mappings associated with your PDF file by [ID] will be deleted.

Creating a form-tag

There are several ways to create tags for CF7 form from PDF form fields.

  1. Insert & Link All button

    This is the recommended method. This button allows you to create form-tags for all remaining unmapped PDF fields, insert them into the CF7 form and link them to the corresponding PDF fields with a single click. Tags are inserted at current cursor position.

  2. Insert and Link button

    When a field is selected in the PDF field dropdown, the New Tag hint for the selected PDF field is shown under the dropdown. The new form-tag can be inserted into the CF7 form and a mapping can be automatically created by clicking the Insert and Link button. Tags are inserted at current cursor position.

    Image 3

    Using any of the above methods should work fine in most cases, however, you must make sure that the format of the mapped CF7 field value match the required format by the PDF field. For example, they may be problems related to incorrect date format (example: dd/mm/yyyy).

  3. Create and map the form tag manually.

    You can create your form-tag manually in the CF7 form and map it to your PDF field by selecting your form-tag in the CF7 field/mail-tags dropdown and clicking the Add Mapping button.

Whichever method you use, your CF7 form should end up looking as follows:

Image 4

Be sure to save the form once you are done mapping all fields. Form settings don’t get saved until you hit the save button.

Now you are done creating the form. Go to the page where you installed the contact form shortcode. The CF7 form filled with data should look similar to the following:

Image 5

When your user fills in and submits the form, the recepient of the submissions will receive a filled PDF file with user data which should look similar to the following:

Image 6

What is in the CF7 field/mail-tags list?

The CF7 field/mail-tags dropdown contains CF7 fields that already exist in the form (see Image 4) and special CF7 mail-tags that are not associated with CF7 fields. You can map a CF7 field or a mail-tag from this list to a PDF field. Custom text or a combination of mail-tags can also be used. Read more about special mail-tags in Contact Form 7 Docs.

Image 7

You can edit mail-tags after adding the mapping. Dynamic data can be filled into PDF fields by using appropriate special mail-tags.

See field mapping for a hands-on example.