Mapping Field Values
Overview
Value mappings allow you to transform the data from your WPForms fields before it’s inserted into PDF form fields. This is particularly useful when:
- Your PDF form requires specific values that differ from what users enter in your form
- You need to convert user-friendly options to codes or standardized values
- You want to map multiple possible form values to a single PDF value
- You need to handle special characters or formatting requirements
In certain instances, the values of your checkbox, multiple choice, or dropdown form fields may not match to the corresponding PDF field values. The mismatch will cause your PDF fields to remain unfilled. 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, multiple choice, dropdown and text field values. If you are unfamiliar with the process of creating field mappings, please refer to the Mapping Form 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 WPForms field later, it becomes necessary to review and update your value mappings accordingly.
Manually Mapping Field Values
Consider the field mapping shown in the following image.
We have a WPForms checkbox field cashier
mapped to the PDF field Cashier with an export value of Yes.
Field Mapping Example
The problem is that the PDF field’s export value is “Yes”. However, the WPForms checkbox field choice 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
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
Now, let’s modify the value in the WPForms for the english
field:
Editing WPForms Field Values
To achieve this, follow these steps:
- Add a new value mapping using the
Map Value
button. - Choose the value from WPForms in the WPForms field / smart tags column.
- Select the corresponding PDF value in the PDF field column.
Adding New Value Mapping
Value-Mapping Multiple Choice Fields
There are several possibilities for mapping multiple choice fields:
- Multiple choice WPForms fields to multiple plain PDF fields
- Multiple plain WPForms fields to a single multiple choice PDF field
- A single multiple choice WPForms field to a single multiple choice PDF field
- Multiple choice fields with mismatched options
Mapping Multiple Choice WPForms Fields to Multiple Plain PDF Fields
If you have multiple checkboxes in the PDF file with different names, you can create a single WPForms checkbox field with multiple options and map it to each PDF checkbox field. Checkbox fields operate by matching the value of the field with the export value of the PDF field. This can be used in conjunction with the value mapping feature to achieve filling multiple fields.
For example, imagine you have a PDF file containing three checkboxes: TRADE CERTIFICATE
, COLLEGE NO DEGREE
, PHD
, each having the export value of On
.
Let’s say you then create a WPForms checkbox field labeled education
with the options trade
, college
and phd
.
What you then will need to do is go to the Field Mapper Tool and map all the fields using the Add Mapping button to connect the education
field with each of the PDF checkbox fields.
Mapping Multiple PDF Checkbox Fields
Once you map the fields as shown above, proceed to map values of the WPForms checkbox field to the PDF checkbox values using the Map Value button. Note that we are mapping to the same value On, except each value mapping is applied to a different PDF field.
Checkbox Value Mapping Configuration
Once you set up your mappings as shown above, your filled PDF file checkboxes should be correctly checked.
Mapping Multiple Plain WPForms Fields to a Single Multiple Choice PDF field
A multi-selectable PDF field in your PDF can be set up to receive input from multiple regular non-multiple-choice WPForms fields.
For example, imagine you need to map multiple WPForms checkboxes to a single multi-selectable PDF field.
Let’s assume we have a PDF file with a field named AvailabilityDays
in which several days of the week can be selected:
Sunday, Monday, Tuesday, Wednesday, Thursday, Friday and Saturday.
You can begin by creating seven checkboxes, one for each day, and mapping them to the multi-selectable PDF field. Note that the value in the form field may differ from the values in the PDF file.
Multiple Checkboxes Configuration
Navigate to the Field Mapper Tool and use the Add Mapping button to map checkboxes to the PDF field AvailabilityDays
.
Mapping to Multi-selectable PDF Field
In this example, the plugin automatically mapped the WPForms and PDF availabilitydays
fields to AvailabilityDays
.
If you do manual field matching, select Custom text string...
or any other WPForms smart tag in the WPForms field / smart tags list.
Using the pencil icon, edit the WPForms field and add the field IDs of your checkboxes, one per line and in curly braces. The field ID can be found in the Fields > Field Options tab. Alternatively, use the Show Smart Tags button to select a field name.
Field ID Mapping Configuration
Now, using the Map Value button, map the values of the WPForms checkbox to the multiple-choice values of the PDF field.
Value Mapping for Multiple Choice Fields
Note that you can use hardcoded values in the form smart tags.
For instance, if you change {field_id="70"}
to Tuesday
, one of the existing fields in the PDF file, you will always get a filled field in the PDF file.
Hardcoded Value in Field Mapping
You can remove the Map Value and even the checkbox field day3
from WPForms, but the Tuesday
field will still be filled in the PDF.
Mapping a Single Multiple Choice WPForms Field to a Single Multiple Choice PDF Field
In this example, we’ll demonstrate how to map a WPForms multiple-choice field to a PDF multiple-choice field.
Consider a PDF file with the field name AvailabilityDays
, allowing the selection of multiple days of the week: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday.
Let’s create a WPForms multi-select dropdown field with the names of the days of the week and map them to the PDF multi-select fields.
For the “Dropdown” field, ensure to enable Select multiple options in Field Options > Advanced tab.
Multi-Select Dropdown Configuration
Proceed to the Field Mapping Tool and use the Add Mapping button to establish the connection between the WPForms and PDF fields.
Note: If the values in the WPForms fields match those in the PDF file, the mapping is automatic and won’t be displayed. However, if you rename values in the WPForms fields (e.g., Friday > Fri and Monday > Mon), you’ll need to perform manual matching, as illustrated in the Value Mapping section above.
Field Mapping for Multiple Choice Fields
Now, when users fill out the contact form on the site, the PDF file will be accurately completed.
Filled PDF with Multiple Choice Selections
Mapping Multiple Choice Fields with Mismatched Options
However, what if we wish to avoid creating as many WPForms fields for the user as there are in the PDF form?
Consider a scenario where our PDF file contains a multi-select AvailabilityDays
field with seven days of the week.
We intend to present the user with a simplified form, categorized into two groups: Working Days and Weekends.
Let’s create an appropriate WPForms field.
In this example, we’ll use a multi-select dropdown box named days
with two choices: Working Days and Weekends.
Alternatively, you can use checkboxes or radio buttons based on your preferences.
Now, navigate to the Field Mapper Tool to establish the mapping between WPForms and PDF fields.
Mapping Fields with Grouped Options
Configure your field groups by adding all working days to Working Days and weekends to Weekends. To achieve this, create a new value mapping in the field mapper tool using the Map Value button as described earlier.
In our example, the value mappings would appear as follows:
Value Mappings for Working Days and Weekends
Save your form and proceed to fill out the WPForms form. Select the Weekends field and submit the form. As depicted in the screenshot, two days were appropriately marked in our PDF: Sunday and Saturday.
Weekend Days Mapping Result
Value-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.
Common Use Cases for Value Mapping
Here are some common scenarios where value mapping is particularly useful:
Converting Yes/No to Different Values
If your PDF form requires specific values for checkboxes or radio buttons:
WPForms Value | PDF Value |
---|---|
Yes | 1 |
No | 0 |
Mapping Dropdown Options to Codes
If your form has user-friendly options but your PDF needs standardized codes:
WPForms Value | PDF Value |
---|---|
United States | US |
Canada | CA |
Mexico | MX |
Handling Special Characters
If your PDF form has issues with certain characters:
WPForms Value | PDF Value |
---|---|
& | and |
% | percent |
Converting Empty Values
You can also specify what should be inserted when a field is empty:
WPForms Value | PDF Value |
---|---|
(empty) | N/A |
To map an empty value, leave the WPForms value field blank.
Using the Map Value Button
Consider the following scenario: you have a PDF file with a field named Country, and you want to set its value to the full name “Australia” as its value. To enhance user convenience, we allow entry of the three-letter country code, such as AUS. Let’s walk through an example to demonstrate how to achieve this.
Begin by creating a Single line text field, named country
.
In the plugin interface, utilize the Add Mapping button to link the WPForms and PDF fields.
Text Field Mapping Setup
Now, with the Map Value button, establish a mapping of field values. In the left column of the WPForms field, input the country code AUS, and in the right column of the PDF field, input the full name “Australia”. Add another field mapping to allow the user to enter N/A.
Country Code to Full Name Mapping
You can create an unlimited number of such field mappings.
Save all changes using the Save button.
Navigate to the page with the contact form, enter the country code AUS in the Country field, submit the form, and you will receive a completed PDF document with the full name of the country in the Country field.
Country Code Mapping Result
If you enter N/A instead of AUS, the result will be Not applicable accordingly. For any other country name not covered in our comparisons, it will be filled in the PDF form as entered, without alterations.
Using hardcode
Assume you have a PDF form with the field name SSN. To ensure that, regardless of user input, the value of this field is consistently populated with hard-coded values, follow these steps:
- Select
Custom text string...
in the WPForms field / smart tags column. - Using the search choose the
SSN
field in the PDF field column. - Click on the Add Mapping button.
Custom Text Mapping Setup
At the end of list, a new text box for mapping will appear.
Enter This is my custom text
into this text box.
Custom Text Entry Field
Hardcoded data takes precedence over user data. When the user completes and submits the form, our custom text will appear in the completed PDF file.
Custom Text Mapping Result