Hard-coding PDF Field Values
Overview
Sometimes you need to hard-code specific values into PDF form fields, regardless of what the user enters in your form. For example, you might want to:
- Set up multiple job application forms that all use the same PDF template but pre-fill different position titles
- Always check certain checkboxes in your PDF
- Include standard text that doesn’t come from user input
- Add timestamps or other system-generated information
Step-by-Step Guide
Let’s walk through an example where we want to hard-code a value for a checkbox field named “Cashier” in a job application PDF, ensuring it’s always checked regardless of user input.
Setting Up Hard-coded Values
-
Navigate to your form’s settings and select the PDF Forms tab
-
In the Field Mapper Tool, select “Custom text string…” from the WPForms fields dropdown
-
Select the field you want to hard-code (in this example, the “Cashier” checkbox field) from the PDF field dropdown
-
Click the Add Mapping button
Adding Custom Text Mapping
-
In the text field that appears in the mapping list, enter the value you want to use:
- For checkbox fields, enter the export value (typically “Yes” or “On”)
- For text fields, enter the exact text you want to appear
- For radio buttons or dropdowns, enter the exact value of the option you want to select
Entering Custom Text Value
-
Save your form settings
Testing Your Hard-coded Values
After setting up your hard-coded values, test your form by submitting it. The PDF should show your hard-coded values regardless of what was entered in the form.
Result with Hard-coded Values
Common Use Cases
Pre-selecting Options
Hard-coding values is useful for pre-selecting options in your PDF, such as:
- Setting default choices for radio buttons
- Pre-checking specific checkboxes
- Selecting specific dropdown options
Adding Standard Text
You can add standard text that doesn’t come from user input:
- Legal disclaimers
- Company information
- Form identifiers or version numbers
Including Dynamic System Information
You can also use WPForms Smart Tags in your custom text to include dynamic information:
- Current date:
{date format="m/d/Y"}
- Site information:
{site_name}
- Page information:
{page_title}
For more information about using Smart Tags, see the WPForms Smart Tags documentation.