Conditional Logic: Show Fields Only When They Are Needed
Wrap fields in a cf7m-if tag to show them only when another answer matches. Hidden required fields never block a submission, and visible ones stay required.
Conditional logic shows a field only when another answer calls for it. Visitors see a shorter form, and you still get the details you need. You set it up with one tag in the Contact Form 7 editor.
First turn on Conditional logic under CF7Mate → Settings.
How do I show a field based on an answer?
Wrap the field in a [cf7m-if] tag. Name the field to watch, and the answer that should show it:
<label>Reason [select reason "General" "Support"]</label>
[cf7m-if field:reason is:Support]
<label>Support details [textarea* support-details]</label>
[/cf7m-if]
[submit "Send"]
Here, Support details appears only when the visitor picks Support. field is the Contact Form 7 field name, such as reason in [select reason ...]. Put a value in quotes when it has spaces: is:"Sales team".
The conditional button above the form editor writes the tag for you.
Which comparisons can I use?
| Write this | Shows the content when |
|---|---|
is:Support |
The answer is exactly Support. This is the default. |
not:Support |
The answer is anything except Support. |
contains:urgent |
The answer includes the text “urgent”. Upper and lower case are treated the same. |
any:"Sales,Billing" |
The answer is one of the values in the list. |
gt:10 or gte:10 |
The answer is a number greater than 10, or greater than or equal to 10. |
lt:10 or lte:10 |
The answer is a number less than 10, or less than or equal to 10. |
empty:true |
The field has no answer. Use empty:false for “has an answer”. |
checked:true |
A checkbox or acceptance field is ticked. Use checked:false for “not ticked”. |
For checkboxes and multi-select fields, the condition matches when any of the chosen options matches.
Can I put one condition inside another?
Yes. Nested [cf7m-if] tags work. The inner content appears only when both conditions match.
[cf7m-if field:reason is:Support]
<label>Product [select product "Plugin" "Theme"]</label>
[cf7m-if field:product is:Plugin]
<label>Plugin version [text plugin-version]</label>
[/cf7m-if]
[/cf7m-if]
What happens to hidden required fields?
They never block a submission. When the form is sent, your server works out which fields were hidden, using the saved form and the answers that were actually submitted. It does not trust the browser for this.
A required field that is visible still has to be filled in. Errors on visible fields always show.
FAQ
Does conditional logic work with multi-step forms?
Yes. Put [cf7m-if] tags inside a step. Hidden required fields do not stop the visitor from moving to the next step.
Does it work with save and continue?
Yes. When a visitor comes back, their saved answers are restored and the right fields show again.
My condition never shows its content. What should I check?
Check that field matches the field name exactly, and that the value matches an option exactly, including capital letters. The contains comparison is the only one that ignores case.
What should I do next?
Send each answer to the right inbox with email routing, or split the form into steps.