Clearing Input Forms with Contact Form 7

Many websites today will not have labels next to their input boxes anymore. Instead they place the text inside the input box. Contact Form 7 plug in can do this out of the box, but the user has to erase what is in the box before they can type in their information. This is a) annoying and b) not user friendly at all. Fortunately there is a hack that makes this work. Special thanks to emj for this solution.

Note that this is a bit of a hack, so not sure how it will work as you upgrade to newer versions.

First: add this javascript to header.php


Second: in the contact form 7 plugin folder, edit file /modules/text.php

Third: find line 76
$html = ‘‘;

Fourth: between ‘input’ and ‘type’, add:
onFocus=”clearText(this)” onBlur=”restoreText(this)”

That should do it. It isn’t perfect, but it works pretty well.

Blocking Spam Bots

By Dave Fogel | May 5, 2015

If you frequently look at your Google analytics and notice you all of a sudden have a huge increase in traffic, you might start getting really excited. The site is finally taking off! Or is it? There is a good chance that bots have started hitting your website. So how can you find out? First…

WordPress Easy Modal and Gravity Forms

By Dave Fogel | February 13, 2015

If you are looking to create a modal box on your site with a gravity form, there is one issue we have run into a few times that can cause you a lot of headaches.  The people at Gravity Forms recommend using Easy Modal for modal boxes with WordPress. In the first instance, we were…

Is your site mobile friendly

By Dave Fogel | February 3, 2015

Making sure your website is mobile friendly is now more important than ever.  But how can you be sure you are mobile friendly? Google has created a testing tool so you can test for yourself.  It is pretty simple to use.  Just type your website into the tool and see what happens. If your mobile…

Posted in

Dave Fogel

Leave a Comment