What is the easiest way to prevent spam in contact or comment forms on a website?
I have a contact form on one of my websites www.lutz-engr.com and was getting some actual people filling out the form for legitimate reasons, but the vast majority of the content was spam from countries such as Russia and from IP addresses reported from many other countries. See my original post on "How to Handle Spammers". Sometimes the forms are filled out in groups and I suspect there is either a system that can disguise its IP address or there is a network of spam controllers running on different computers. Either way I always found that the spammed forms had one thing in common...
<form action="" method="PUT" name="contact_form"> Your Name: </div> <input type="text" name="name_field" size="35">*<br> Phone: </div> <input type="text" name="phone_field" size="35"><br> Email: </div> <input type="email" name="email_field" size="35">*<br> <input type="hidden" value="nojs (unused)" name="timedayjs" id="timedayjs"> <input type="submit" value="Submit" name="comment_submit_button" id="comment_submit_button" disabled="disabled"> </form>
Change your form so that it is initially disabled in HTML
- Submit Button - This I set to disabled="disabled" so a regular user that had javscript disabled would notice they couldn't click on the form. Of course a spammer could just ignore this directive, but without the correct form method and form action the results still won't get sent to the server.
All of these actions has resulted in a drastic reduction of spamming through our contact us forms on the website. Please try this code on your site. Leave a note or +1 if you feel this was helpful.