Mapping Field Values

In certain instances, the values of your checkbox, multiple choice, or dropdown form fields may not match the corresponding PDF field values. The mismatch will cause your PDF fields to remain unfilled or be filled with incorrect data. You must configure value mappings to resolve this issue.

It is not necessary to configure value mappings if your field values match.

Alternatively, there may arise a need for you to configure value mappings for text fields.

In this article, we will look at methods for matching checkbox, radio, select, and text field values. If you are unfamiliar with the process of creating field mappings, please refer to the Mapping Fields article.

Automatic Value Mapping

When creating new field mappings, automatic value mappings are generated for certain fields. Please note that this functionality is applicable only during the initial creation of field mappings. If you modify your CF7 form-tags later, it becomes necessary to review and update your value mappings accordingly.

Manual Field Value Mapping

Let’s assume we have a CF7 checkbox form-tag [checkbox cashier "Cashier"] mapped to PDF field Cashier with an export value of Yes. Our field mapping will look as shown in the following screenshot of the Field Mapper Tool:

Field Mapping Example

The problem is that the PDF field’s export value is “Yes”. However, the CF7 checkbox form-tag value is “Cashier”. So, the PDF checkbox will not be filled as checked when Cashier is checked in the web form. In order to fix this issue, it is necessary to create a value mapping. Click the Map Value button and select the appropriate options in the dropdowns, as shown below.

Value Mapping Options

Now your PDF field will be filled correctly when the CF7 field is checked.

Updating Value Mappings

Consider a scenario where there are three checkboxes: cashier, english, and espanol. Please note that mappings for the last two checkboxes are absent as their values match.

Multiple Checkbox Mappings

Let’s say we want to change the checkbox value in the CF7 form-tag for the english field to English Language due to our requirements.

Editing CF7 Field Values

This will break the field mapping. To fix it, we need to create a new value mapping. Let’s click the Map Value button and select appropriate options in dropdowns.

Adding New Value Mapping

Mapping Multiple Choice Fields

Value-mapping multiple choice fields is very similar to value-mapping regular fields. There are some things that should be kept in mind, however.

Value-mapping a multiple choice CF7 field to a multiple choice PDF field

Contact Form 7 checkboxes and drop-downs can be multiple choice. PDF list boxes can also be multiple choice. Sometimes, you will want your CF7 field options to be named something other than what you have in your PDF list box.

In this example, we will map a multiple choice CF7 field to a multiple choice PDF field. Let’s assume we have a PDF file with a list box named AvailabilityDays, in which you can select any number of days of the week (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday). We will need to create a similarly configured multiple choice CF7 form-tag [select availabilitydays multiple include_blank "Friday" "Monday" "Saturday" "Sunday" "Thursday" "Tuesday" "Wednesday"] and map it to the PDF’s list box field.

Multi-Select Dropdown Configuration

Let’s go to the Field Mapper Tool and use the Add Mapping button to map the CF7 and PDF fields.

Mapping to Multi-selectable PDF Field

Note that the values ​​in the form-tag do not differ from the values ​​in the PDF file. Therefore, value mappings do not need to be created. If you rename values ​​in the form-tag, for example, Friday to Fri and Monday to Mon, then you need to match these values ​​manually, as shown in the Field Mapping for Multiple Choice Fields image below.

Field Mapping for Multiple Choice Fields

Now, when a user submits the contact form, the PDF field will be successfully filled.

Filled PDF with Multiple Choice Selections

Value-mapping a multiple choice CF7 field to multiple plain PDF fields

Consider the case in which we have multiple checkboxes in the PDF file with different names and we want to create one CF7 checkbox field with multiple options and map it to each PDF checkbox field. Filling PDF checkbox fields works by having the value being filled match the PDF field’s export value, if they match then the PDF checkbox is checked, if they don’t match then it isn’t checked. We can use this in conjunction with value mapping feature to achieve multiple field filling.

Let’s assume we have a PDF file with three checkboxes: TRADE CERTIFICATE, COLLEGE NO DEGREE, and PHD. Let’s create a form-tag education with the values trade, college, and phd. The form-tag would be [checkbox education "trade" "college" "phd"]. Let’s go to the Field Mapper Tool and use the Add Mapping button to map the education field to the three PDF fields.

Mapping Multiple PDF Checkbox Fields

Now, in the Field Mapper Tool, let’s map CF7 checkbox values to PDF checkbox values.

Checkbox Value Mapping Configuration

Notice that we are mapping to the same value On, which is the export value for all three checkboxes in the PDF file.

Value-mapping multiple plain CF7 fields to a single multiple choice PDF field

Consider the case in which we have multiple CF7 checkboxes with different names and we want to map them all to a single multiple choice PDF field. Another related case may be that we have data from single or multiple mail-tags that we want to fill into a single multiple choice PDF field.

Filling PDF checkbox fields works by having the value being filled match the PDF field’s export values. It is not possible to map multiple CF7 fields to a single PDF field. However, you can make use of mail-tags mapping in conjunction with the comma separated list filling feature to fill a PDF field with multiple values. The comma separated list filling feature will also allow filling of multiple choice PDF fields with data from mail-tags.

Let’s assume we have a PDF file with a field name AvailabilityDays in which multiple options (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and/or Saturday) can be selected. Let’s create a checkbox for each day ([checkbox day1 "Sun"], [checkbox day2 "Mon"], [checkbox day3 "Tue"], … [checkbox day7 "Sat"]) and map them to the PDF field. Notice that the checkbox value in the CF7 form-tag is different from the values in the PDF file.

Multiple Checkboxes Setup

Let’s access the Field Mapper Tool and use the Add Mapping button to map mail-tags to the AvailabilityDays PDF field by selecting Custom text string... in the CF7 field/mail-tags drop-down list. Once whe have the mail-tags text area ready to accept input, we need to list the CF7 mail-tags associated with our checkboxes, separated by commas.

Mail Tags Mapping

Now, using the Map Value button, we need to map the values of the CF7 checkbox to the multiple choice values of the PDF field.

Mail Tags Value Mapping

It is possible to hard-code a specific value in the comma-separated list. For example, if we change [day3] to Tuesday in the mail-tags mapping text box then this option will always be selected in the list box in the filled PDF file. We should then remove the Tue to Tuesday value mapping and the [checkbox day3 "Tue"] form-tag because these will no longer be necessary.

Hardcoded Value in Field Mapping

Value-mapping Multiple Choice Fields with Mismatched Options

Up to this point we assumed that there is a 1-to-1 correlation between CF7 values and PDF options. However, a situation may arise when you would want to value-map one value to multiple values and vice versa. This can be configured by adding multiple value mappings for the same CF7 or PDF value.

Consider the case in which we have a multiple choice AvailabilityDays field with seven days of the week. Let’s assume that we want to ask the user to select out of only two options: Weekdays and Weekends. The CF7 form-tag might be [select days multiple "Weekdays" "Weekends"]. If necessary, you can also use a checkbox or radio buttons.

We will need to create the following field mapping in Field Mapper Tool:

Mapping Fields with Grouped Options

Let’s map all working days to Weekdays and weekends to Weekends. To do this, we need to create a new value mapping in the Field Mapper Tool.

Value Mappings for Working Days and Weekends

Now, when the form is submitted with Weekend being selected in the CF7 field, your PDF field is filled with Sunday and Saturday.

Weekend Days Mapping Result

Mapping Text Fields

In addition to matching values for checkboxes and multi-selects, it’s also possible to perform value mapping for text fields. Let’s explore various options.

Consider the case in which we have a PDF file with a text field named Country and the CF7 form-tag [text country]. The field mapping would look as follows:

Text Field Mapping Setup

The assumption is that the user enters a full country name, however, some users enter country code or other text that we want to expand. To enhance user convenience, we allow entry of the three-letter country code, such as AUS. Let’s say we want to convert AUS into Australia and N/A into “Not applicable”. The value mappings would need to look as follows:

Country Code to Full Name Mapping

We can make a very large number of such value mappings, as the need arises.

Now, the user data will be replaced on the fly during the filling process.

Country Code Mapping Result

If the user enters N/A, the resulting filled field will contain Not applicable. If you enter the name of any other country for which we did not create a value mapping then it will be filled as is without changes.