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:
The possibilities are endless!
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.
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.
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:
[
and ]
). So, instead of [my_shortcode key='value']
you would use my_shortcode key='value'
.my_shortcode key='value'
and not my_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:
'
%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:
'
%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.