Description
Contact Form 7 is an excellent WordPress plugin and one of the top choices of free WordPress plugins for contact forms. Controller Fields makes it even more awesome by adding dynamic content capabilities. This plugin provides new form tags for select fields, checkboxes, and radio buttons so you can use them to control the display of other fields and content. Some examples might include:
- Hiding or revealing additional form fields based the current value in a dropdown
- Hiding or revealing content when users click a checkbox
- Hiding or revealing information based on which radio button is currently selected
- Controllers and controlled fields can be nested
The possibilities are endless!
View Demo
Preview this plugin in the WordPress Playground, a sandbox environment where you can explore the features of this plugin, both in the WordPress backend as an admin user and on the frontend.
WHAT DOES IT DO?
This plugin creates three (3) new form tags for controlling the appearance of other form tags (aka “controller”) and a special form tag generator button to output the HTML needed to wrap the controllable form tags inside.
HOW TO USE IT
After installing and activating the plugin, you will have four (4) new buttons at the top when creating or editing a Contact Form 7 form: select controller, checkbox controller, radio controller, and controlled form tag wrapper. Most of the options in their tag generators will be familiar to Contact Form 7 users but there have been some upgrades.
Id Attribute
The frontend script relies on unique IDs for the controller form tags, so be sure to always set one!
Options
There are three (3) ways you can define your options. The first method is simply typing your options with each one on a new line, e.g.:
Apples Bananas Dragonfruit
The second method is similar, but it allows you more control over the value and label by using |
to separate them, e.g.:
fruit_1 | Apples fruit_2 | Bananas fruit_3 | Dragonfruit
The third method is dynamic in that you can use a shortcode to populate your options with two important provisions:
- The shortcode should NOT include the normal square brackets (
[
and]
). So, instead of[my_shortcode key='value']
you would usemy_shortcode key='value'
. - Any parameters in the shortcode must use single quotes. That is:
my_shortcode key='value'
and notmy_shortcode key="value"
Shortcodes used here should return a string value with the option or option group HTML.
Default value
This field can take static text or a shortcode. If using a shortcode, the same syntax applies from the options field. However, this field also has a few more needs:
- The text/shortcode must first have apostrophes converted to it’s HTML entity code,
'
- After that, it must be URL encoded so that spaces become
%20
and other non-alphanumeric characters are converted.
Placeholder
Only available for the select controller form tag, this field can take static text or a shortcode. If using a shortcode, the same syntax applies from the options field. However, this field also has a few more needs:
- The text/shortcode must first have apostrophes converted to it’s HTML entity code,
'
- After that, it must be URL encoded so that spaces become
%20
and other non-alphanumeric characters are converted.
Read Only Attribute
Simply check this box if you do not want to let users edit this field. It will add the readonly
attribute to your form field.
Disabled Attribute
Simply check this box if you do not want to submit this field in the form. It will add the disabled
attribute to your form field.
Installation
Minimum Requirements
To ensure your WordPress installation meets these requirements, you can login to your WordPress website and navigate to Tools > Site Health and click on the Info tab. Expand the WordPress, Active Plugins, and Server accordions and compare that information with the details below.
- WordPress version 5.5 or greater
- PHP version 7.4 or greater
- Contact Form 7 version 5.7 or greater
There are three (3) ways to install my plugin: automatically, upload, or manually.
Install Method 1: Automatic Installation
Automatic installation is the easiest option as WordPress handles the file transfers itself and you don’t need to leave your web browser.
- Log in to your WordPress dashboard.
- Navigate to Plugins > Add New.
- Where it says “Keyword” in a dropdown, change it to “Author”
- In the search form, type “TessaWatkinsLLC” (results may begin populating as you type but my plugins will only show when the full name is there)
- Once you’ve found my plugin in the search results that appear, click the Install Now button and wait for the installation process to complete.
- Once the installation process is completed, click the Activate button to activate my plugin.
Install Method 2: Upload via WordPress Admin
This method involves is a little more involved. You don’t need to leave your web browser, but you’ll need to download and then upload the files yourself.
- Download my plugin from www.ads-software.com; it will be in the form of a zip file.
- Log in to your WordPress dashboard.
- Navigate to Plugins > Add New.
- Click the Upload Plugin button at the top of the screen.
- Select the zip file from your local file system that was downloaded in step 1.
- Click the Install Now button and wait for the installation process to complete.
- Once the installation process is completed, click the Activate button to activate my plugin.
Install Method 3: Manual Installation
This method is the most involved as it requires you to be familiar with the process of transferring files using an SFTP client.
- Download my plugin from www.ads-software.com; it will be in the form of a zip file.
- Unzip the contents; you should have a single folder named
controller-fields-for-contact-form-7
. - Connect to your WordPress server with your favorite SFTP client.
- Copy the folder from step 2 to the
/wp-content/plugins/
folder in your WordPress directory. Once the folder and all of its files are there, installation is complete. - Now log in to your WordPress dashboard.
- Navigate to Plugins > Installed Plugins. You should now see my plugin in your list.
- Click the Activate button under my plugin to activate it.
FAQ
Please check out the FAQ on our website.
Reviews
Contributors & Developers
“Controller Fields for Contact Form 7” is open source software. The following people have contributed to this plugin.
ContributorsTranslate “Controller Fields for Contact Form 7” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Changelog
2.0.0
Release Date: September 1, 2024
- Major: Refactored admin functionality into class
- Feature: Added
number_controller
form tag; use the number text input/spinbox as a controller. - Feature: Added
range_controller
form tag; use the numeric slider as a controller. - Feature: Updated controlled items to allow multiple controllers for
OR
statements. Use the pipe (|
) character to separate controllers. If an element has multiple controllers, then there should be adata-{controller ID}-values
attribute that sets the values for that specific controller instead of the genericdata-values
attribute. - Feature: Updated controlled items to allow for numerical comparison operations. Prefix a number with two dashes to perform less than or equal to comparisons (e.g.
--100
). Suffix a number with two dashes to perform greater than or equal to comparisons (e.g.5--
). Use a single dash between two numbers to perform an inclusive BETWEEN comparison (e.g.5-100
). - Feature: Set the controller’s value to
BLANK
orEMPTY
to match only blank or empty values. - Feature: Set the controller’s value to
*
to match any truthy value. - Feature: Set the controller’s value to
EMPTY_OR_ZERO
orFALSEY
to match any falsey value. - Feature: Prefix a controlled element’s value with
!=
to match everything except that value.
1.1.1
Release Date: April 16, 2024
- Fix: Addressed a bug introduced in version 1.1.0 that prevented frontend assets from loading.
1.1.0
Release Date: April 15, 2024
- Feature: Number fields can now be controllers. They display controlled fields based on number ranges set in the controlled element’s values.
- Feature: Controlled fields can now have multiple controllers. The
data-controller
value should be a pipe-delimited list of controller IDs. If it has multiple controllers, then there should be adata-{controller ID}-values
attribute that sets the values for that specific controller. Controlled fields with multiple controllers are only hidden if all controllers evaluate to no matches. Otherwise, it will remain visible. Multiple controllers are treated as an OR comparison, meaning at least one controller must be active for the controlled field to display. Nest them to treat them as an AND operation. - Feature: Values can include operations such as
>
,>=
,<
,<=
,!=
,*
,BLANK
,EMPTY_OR_ZERO
. The operation=
is assumed when no comparison is found. - Fix: added
!important
toau-cf7-controller
CSS to ensure it’s hidden in case of conflicting styles.
1.0.2
Release Date: May 5, 2023
- Fix: modifications from plugin review
1.0.1
Release Date: May 1, 2023
- Fix: modifications from plugin review
1.0.0
Release Date: March 30, 2023
- Major: first submission!
Full Changelog
Please see our additional changelog.txt file