Combat Contact Form Spam

combating inbound spammer from forms
Home » Blog » Combat Contact Form Spam
Table of Contents
    Add a header to begin generating the table of contents

    There’s nothing more frustrating than opening up your email in the morning and seeing a new contact form submission has come in off your website and realizing its just another spammer sending you a pitch. Spam, especially in the United States, has become a serious problem. You’re literally being targeted by the entire world! It can be especially bad if your using a highly targeted CMS like WordPress to power your site. This article will go through some tactics to stop contact form spam, regain a little bit of your sanity, and restore hope when checking your new contact form submissions.

    Spammers Are Lazy

    One great thing I’ve learned is that many spammers are lazy. Many of them are super cheap resources in foreign countries playing the numbers game. The slightest bit of difficulty encountered usually results in giving up and moving on the to the next victim.

    When combating spam and trying to stop contact form spam presenting minor difficulties can be an effective method of defending your website.

    Blocking Copy Paste

    One effective method I’ve seen to stop contact form spam or stop form spam in general is to disable pasting on html textarea fields. Textarea fields are most often going to be your long form description fields where someone actually types the message they want to send to you.

    stop contact form spam disable paste on textarea
    Textarea field on a Tortoise and Hare Software’s Contact form

    Disabling paste on a field is bad for usability and accessibility so it’s something to be used very sparingly. Textarea fields are going to be where a spammer is most likely to copy their pre-written pitch and paste it into the text area. If they can’t do that they are very unlikely to be determined enough to manually write their entire message into the field and most likely will just close the browser window and move on to the next target on the list.

    How To Block Pasting To Stop Contact Form Spam

    There are two ways a spammer can paste something into a field, the keyboard and the context menu. The keyboard paste is most often accomplished using the well known ctrl-v command and the context menu paste is accomplished by pressing right click on the mouse within the field and then selecting paste from the context menu. We need to prevent both if we want to stop spammers from blowing up our inbound forms.

    context menu paste command stop spam
    Context menu with paste command

    This activity requires a developer to add some JavaScript to your page. Below is the base JavaScript you’ll need to add to block contact form spam.

    This code requires a teensy bit of customization so can’t be blindly copy pasted. There are two things you’ll need to update

    • YourEventTypicallyDocumentReady
    • YourFormFieldSelector

    YourEventTypicallyDocumentReady

    In general you’ll want to run this code on document ready but certain plugins, ninja forms for instance, take advantage of that event handler already so you may need to hook into a custom after form ready event or later event. A developer should be able to help you figure this out.

    YourFormFieldSelector

    Next you’ll need to choose the form field selector you want to disable the appropriate form fields. This could range from a specific form with an element selected by #ID or a class that you use to tag all the form fields you want to disable paste on to stop contact form spam. .stop-spam for instance.

    stop contact form spam with a JavaScript developer

    If you’re feeling a little overwhelmed by any of the JavaScript, I’ve included a video walk-through with some additional commentary on working with the snippets below.

    Stopping Contact Form Spam

    Unfortunately spam is an ongoing problem and in all reality it’s nearly impossible to block all spam. There are ways spammers could bypass this method but most of them are too lazy or don’t have the development capabilities to bypass. You can block a pretty significant portion of contact form spam with a small update to your JavaScript code. We hope you enjoyed the article and can benefit from this snippet! Got any other tips for stopping spam? Drop us a line, we’d love to hear from you.

    Share This Article
    Posted in:
    Tagged:

    Hunter Nelson

    Hunter is the founder and president of Tortoise and Hare Software, a digital marketing agency for B2B technology companies. Hunter has more than 10 years’ experience building web applications and crafting digital strategies for companies ranging from scrappy startups to Fortune 50 household names. When not on the clock, you'll find him spending time with his family and pups, relaxing on the beach, or playing competitive online video games. See LinkedIn for more.

    3 Comments

    1. Daniel on April 8, 2021 at 4:29 am

      Thanks for providing the JavaScript to disable pasting of text on our contact form! It reduced some of the spam that I received from my WordPress sites. However, some really determined spammers were able to overcome it by either disabling JavaScript on the browser or by typing out the entire spam message by hand.

      Instead of fighting this on the client side, I found a way of filtering out spam on the server side, using Artificial Intelligence (AI). By following simple instructions from this page: https://blog.ivertech.com/blog/how-to-install-ivertech-spam-free-contact-code-on-wordpresscom I was able to embed one line of HTML code on my WordPress site and let Artificial Intelligence figure out if a message is spam or not.

      I was able to weed out close to 95% of the spam from my contact forms since I embedded the code. It was really easy to implement, and best of all it’s free! Just thought your audiences might find this useful.

    2. barry - web designer on September 28, 2021 at 4:26 am

      onCopy=’return false’ onDrag=’return false’ onDrop=’return false’ onPaste=’return false’

      add this to your form fields.

    3. DCC Scotland on April 20, 2022 at 11:47 am

      blocking spam on contact form now days very easy. in word press so many plugin to use.
      Use WordPress Antispam Plugins
      Use the Honeypot Antispam Method
      Use a Custom CAPTCHA
      Use reCAPTCHA
      Block Traffic by IP Address

    Leave a Comment





    Table of Contents
      Add a header to begin generating the table of contents

      Free Email Course:
      Launching Your B2B Digital Marketing Program

      Enroll in our free digital lead generation crash course. A 60 day email series with twice a week emails walking through the journey of how to launch your digital marketing program and generate more B2B leads from your website. Unsubscribe at any time.

      Recent Posts
      b2b website cost being calculated

      Why A B2B Website Should Cost $10,000+

      In today’s post, I want to break down a common misalignment between B2B website purchasers and agencies when it comes to website development. Website pricing, like all goods and services, is driven by supply and demand. Website supply is somewhat flooded with drag and drop website builders and DIY options on platforms like Wix and…

      5 second test for ppc landing pages

      The 5 Second Test For PPC Landing Pages

      I’ve been having a lot of conversations recently about optimizing websites for lead generation and explaining a concept called the 5 second test. The 5 second test is a design usability test that aims to help usability testers evaluate and prove the effectiveness of user experiences designs. The idea is that you show someone a…

      saas on a subdomain

      Why You Should Keep Your SaaS Installed On A Subdomain

      More than a few SaaS founders start out with a technical background, looking to parlay their coding skills into a product and build a business off it. Their surplus of coding ability and lack of practical business sense can sometimes lure them into a trap though, and that trap is attaching their marketing website to…

      Top Content
      sample brand kit

      Branding Your MSP: How To Get Started

      Throughout the process of launching and running Tortoise and Hare Software these past 3-4 years there’s one thing that I’ve gotten consistently good feedback on. The brand! People who aren’t shopping for marketing, and have no relationship to the company will regularly come up to me at trade shows, or comment on my business card,…

      msp paid search campaigns

      The Ultimate Guide To Paid Search On Google Ads For Managed Service Providers

      Generating leads for your MSP can be a challenge. You spend so much time managing employees, making sure customer support tickets are answered, procuring hardware, and defending against cyber threats, there’s hardly time to worry about networking and doing things like posting on social media. However, you’d like to grow faster, and due to some…

      msp seo ultimate guide

      The Ultimate Guide To MSP SEO

      Search Engine Optimization (SEO) is one of the most important ways to attract new business for mid-market managed service providers (MSP). If you look at MSPs that have achieved any sort of meaningful scale and grown to the 10MM ARR mark and beyond, you will almost always see a significant portion of their growth came…

      About Us

      Tortoise and Hare Software is a boutique B2B tech marketing agency. We help companies like MSPs, SaaS providers, cybersecurity firms, and other technology service providers launch their digital marketing programs and generate inbound leads.