Hidden Fields Module for Contact Form 7 (2.x) WordPress Plugin

July 24, 2009

in WordPress

Add hidden fields to a great form creating plugin!

I love the Contact Form 7 plugin, and use it for many of my projects…but one thing it’s missing is the ability to add hidden fields.

Now that Contact Form 7 2.0 has been released, it’s easy to add new types of inputs.  Add hidden tag functionality and “Generate Tag” capability by downloading the file below and replacing/adding the three files included.

Updates:

  • August 5, 2009 – Now updated for 2.0.1
  • August 11, 2009 – Fixed bug with 2.0.1 Version. Thanks, @Courtney

  Contact Form 7 2.0.1 - Add Hidden Fields (13.0 KiB, 492 hits)

  Contact Form 7 2.0 - Add Hidden Fields (11.8 KiB, 322 hits)

Did this make your life easier? Was this information worth a buck?
Donate with PayPal (Much appreciated!)

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • StumbleUpon
  • Technorati
  • Twitter

Related posts:

  1. Constant Contact WordPress Widget – Add a Newsletter Signup Form to your Sidebar
  2. WordPress Comment Form 404 Error – Now Fixed!
  3. SEO WordSpinner Plugin – A Killer SEO Plugin for WordPress
  4. Mad Mimi Plugin for WordPress
  5. How to tell if your WordPress Plugin or Widget is Activated in WordPress

{ 29 comments… read them below or add one }

Lee Trampleasure July 24, 2009 at 6:32 am

I posted this question on the WP support forum as well, but thought I might get a faster answer here, so here it is again:

I need to send an email to a sendmail bot with the following PHP mail function:
mail(to,subject,message,headers,parameters)
I can get it to do everything except add the last parameter (it needs to be -f –using the Contact Form 7 code to extract the email address).

Will this plug in do this for me?

Thanks.

Reply

Zack Katz July 24, 2009 at 1:46 pm

I would post that question on the website of the plugin itself, not only the WordPress.org support page.

Reply

Richard July 28, 2009 at 7:51 pm

i tried to put a template tag “” inside y hidden field but dosent work, anywone can help me please.

Reply

Zack Katz July 28, 2009 at 9:14 pm

Please put the code inside <code> and </code> tags, so that it shows up in your comment.

Reply

Len July 30, 2009 at 11:59 am

Hi Zack,
How can we include the %post_title% from which the contact form was embedded ? Possibly the post title could be the default value of a text field which is then sent in the “additional headers” section…
Regards,
Len

Reply

Zack Katz July 30, 2009 at 2:00 pm

I believe that would need to be a different module. You could just modify this, if you wanted to… I don’t have the time right now.

Reply

Hasnain Saleem August 5, 2009 at 9:40 am

Great work. Seems like it will work with only 2.0 (and not 2.0.1, which is the current version). Let me try to get my hands dirty and see if I can help.

Reply

Zack Katz August 5, 2009 at 8:48 pm

I’ve updated the module for 2.0.1 — here’s a download link.

Reply

wieyoga February 2, 2010 at 8:18 am

The link its not work
Invalid File ID or File Name.

Reply

Courtney August 7, 2009 at 2:40 pm

When I move over the files, I get this error:

Fatal error: Call to undefined function wpcf7_admin_url() in /home/content/i/n/t/intweb/html/getintouch/wp-content/plugins/contact-form-7/admin/admin-panel.php on line 40

Reply

Courtney August 7, 2009 at 5:35 pm

So, I looked at the original admin.php file and it has a function called “wpcf7_admin_url” which is missing from your new one, which overwrote it. When I added function into your admin.php, the error went away.

Reply

Zack Katz August 7, 2009 at 7:17 pm

Thanks for the heads up, I will look into it.

Just to check, did you download the correct version? There are two versions: 2.0 and 2.0.1.

Reply

Zack Katz August 11, 2009 at 4:01 pm

I’m not sure how that happened, but I’ve fixed this in the downloadable version. Thanks for your help!

Reply

Hasnain Saleem August 9, 2009 at 5:46 pm

Thanks a ton! I was trying to reverse engineer the “text” handler, but somehow that didn’t seem to work. I’ve installed the updated version, but the admin panel for CF 7 doesn’t load and the module doesn’t seem to work. I guess my PHP error messages are disabled, as I don’t get to see any error messages.

Reply

Hasnain Saleem August 9, 2009 at 5:59 pm

Update: Deleted the admin files, left the module file in place. Hidden fields are now parsed in generated forms. But when the forms are submitted, the placeholders [place-holder] are not replaced.

Reply

Bart August 10, 2009 at 6:11 pm

Thanks Courtney, I had the same error.

The function was left out of the Misc. section of the 2.0.1 update file.

Seems to be fine now.

Thanks for a great plugin

Reply

Hasnain Saleem August 11, 2009 at 11:08 am

Update 2: I uploaded the file “hidden.php” to the modules directory, and manually copied the changes to “admin.php” and “wpcf7-admin.js” in the admin folder. All works well now.

Reply

Aga Tambor August 19, 2009 at 3:47 pm

How can I add value to hidden field in this plugin?
Can somebody give example of use?

Thanks

Reply

Small Business Help August 28, 2009 at 4:41 pm

Thanks for the great update to this plugin. I’m a little surprised it doesn’t natively come with hidden fields options. Hidden fields are an excellent way to get info from form submissions.

Reply

Catalin HODIS October 2, 2009 at 8:50 pm

I need the value of the hidden field to be set from the query string.
Any ideas how to do this?

Thanks a lot!
By the way it’s an update, to this great plugin, very helpful for many.
Tahnks again.

Reply

Zack Katz January 4, 2010 at 4:44 pm

The Gravity Forms plugin has this functionality built in, as does cForms.

Reply

רופא שיניים October 21, 2009 at 10:06 pm

Also looking for a solution to send query string.

Reply

Zack Katz January 4, 2010 at 4:44 pm

I recommend using the Gravity Forms plugin.

Reply

l33r October 24, 2009 at 10:41 pm

This doesn’t work with WP 2.8.5 and CF7 2.0.6 . Error I get in Admin is:

Fatal error: Cannot redeclare wpcf7_admin_url() in /home/xxx/public_html/wp-content/plugins/contact-form-7/admin/admin.php on line 324

I really need hidden fields to work with this plugin :(

Thanks for all your help!

Reply

Zack Katz October 27, 2009 at 6:38 pm

I will be updating this to work with 2.0.6 eventually, but not in the next couple of weeks. Sorry!

Reply

Craig Neil January 4, 2010 at 6:36 am

@Zack  How about in the next couple of months?  Is the download link available?

Reply

Zack Katz January 4, 2010 at 4:43 pm

Hi Craig,
I didn’t know the downloads had disappeared. They’re back up now.

I am no longer going to support this modification, because the plugin author continues to not add this simple functionality, and the modules functionality requires modifying the plugin core files.

Reply

Try January 23, 2010 at 12:29 pm

How can I make the input fields smaller in width?

Reply

לימודים January 31, 2010 at 12:34 pm

I heard there’s a written addition to CF7 which allows you to store query string parameters. Anyone?

Reply

Leave a Comment

Previous post:

Next post: