Mapping field values
Some of your CF7 field values will happen to not match what you need to fill into PDF fields. Missmatching field values will cause some PDF fields to be unfilled, or filled with the wrong data. You will need to create value mappings to resolve such issues.
If you haven’t seen how to create a field mapping yet, take a look at mapping fields page.
We will look at methods for matching
text field values.
Automatic value mapping
Before we explain the process of creating manual value mappings, you should know that when you create new field mappings, you may notice that value mappings are automatically created for some fields. This only works when new field mappings are created. If you change your CF7 form-tags later, you may need to revise your value mappings.
How to value-map fields manually
Let’s assume we have a CF7 checkbox form-tag
[checkbox cashier "Cashier"] mapped to PDF field
Cashier with an export value of
Our field mapping will look as shown in the following screenshot of the Field Mapper Tool:
The problem here is that the string
Cashier doesn’t match
Yes, so, your
Cashier PDF field will not be filled correctly.
What we need to do is create a value mapping from
Cashier on the CF7 side to
Yes on the PDF side.
Let’s click the Map Value button and select appropriate options in dropdowns.
Now your PDF field will be filled correctly when the CF7 field is checked.
How to update value mappings
Consider the case in which we have three checkboxes:
espanol. Notice that there are no mappings for the last two checkboxes because their values match.
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.
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.
How to value-map 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 (
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.
Let’s go to the Field Mapper Tool and use the Add Mapping button to map the CF7 and PDF fields.
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,
Mon, then you need to match these values manually, as shown below.
Now, when a user submits the contact form, the PDF field will be successfully filled.
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 achive multiple field filling.
Let’s assume we have a PDF file with three checkboxes:
COLLEGE NO DEGREE, and
PHD. Let’s create a form-tag
education with the values
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.
Now, in the Field Mapper Tool, let’s map CF7 checkbox values to PDF checkbox values.
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 (
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.
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.
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.
It is possible to hard-code a specific value in the comma-separated list.
For example, if we change
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
Tuesday value mapping and the
[checkbox day3 "Tue"] form-tag because these will no longer be necessary.
Value-mapping multiple choice fields with missmatching number of 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 vise 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:
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:
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.
Now, when the form is submitted with
Weekend being selected in the CF7 field, your PDF field is filled with
How to value-map text fields
We can map values not only for export value fields but also for other kind of fields. There may be multiple reasons for value-mapping text fields. For example, situations may arise that will require replacement of text values.
Consider the case in which we have a PDF file with a text field named
Country and the CF7 form-tag
The field mapping would look as follows:
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.
Let’s say we want to convert
N/A into “Not applicable”.
The value mappings would need to look as follows:
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.
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.