At some point, you will want to add a hidden field to a form that you have created with Contact Form 7.
So, how do you do it?
Given below are the steps to add a hidden field in Contact Form 7:
1. Edit the form.
Go to Contact > Contact Forms page from the left-side menu in your WordPress Admin Panel. Then, edit the form on which you want to place the hidden field.
2. Add the field to be hidden on the form.
Once you are on the Edit Contact Form page, add the field to the form that you want hidden. Don’t forget to set a default value to the field.
3. Add hidden after opening bracket of the field.
Now, in the newly added field, write the word hidden after the opening bracket of the field’s form-tag.
For example, [hidden text new-field]
Then, save the form.
And that’s it.
You have now added a hidden field with a default value to your form.
You added a default value for the hidden field as a static value.
But, what if you want to set a default value dynamically when the form gets submitted?
In that case, refer these help docs from Contact Form 7:
- Getting default values from the context
- Setting default values to the logged-in user
- Getting default values from shortcode attributes
You can also do a lot of other stuff with the Contact Form 7 plugin.
Here are some tutorials to help you get the maximum out of this plugin:
- 2 Simple Methods To Style Contact Form 7 Without Code
- How To Add Placeholder In Contact Form 7? (In 2 Easy Steps)
- How To Add cc and bcc Fields In Contact Form 7? (Simplest Way)
- How To Add Radio Buttons In Contact Form 7? (Without Code)
- How To Add Background Image In Contact Form 7 Without CSS
- How To Add Checkbox In Contact Form 7 Without Code?
- How To Add Contact Form 7 Form In Elementor Without Any Plugin
I hope you liked this small tutorial.
If you found this tutorial useful, then please share it with your friends, I will really appreciate it.