Menu Online Learning Center from EZ-NetTools

Stop Form Spam

We all hate it when we get spam from our forms.  Help sort it out by pasting this javascript code at the bottom of your page and then using your email to filter it out based on it's subject.  Read more below for details.


<script>
// form bot trap
(function() {
var f = document.forms, nm = ['FORMsubject', 'FORMname'], i = f.length-1, j = nm.length-1, re = /^_SPAM_ ?/;
for (; i >= 0; i --) {
  for (; j >=0; j--) {
    if (f[i][nm[j]] && f[i][nm[j]].value.match(re)) {
      f[i][nm[j]].value = f[i][nm[j]].value.replace(re, "");
    }
  }
}
})();
</script>


1. Copy the code above and paste it in the Page Footer of the webpage that has the form that's getting spammed.

2. In the subject of the form manager add _SPAM_ to the beginning of the subject.

3.  Tell your email client to filter out any emails that start with _SPAM_

How it Works

Basically, your form will be set to send an email that starts with _SPAM_.  When a real person comes to your page and submits the form, the javascript will remove the _SPAM_ from the subject.  When a SPAM BOT goes to your page, the javascript wont run because spam bots generally don't run on-page javascript.

Limitations?

This script is made specifically for EZ-NetTools forms, and wont work on other websites, so don't bother trying to add it to your wordpress blog or something like that.

Adding this script requires the user to have javascript turned on.  Most people generally have javascript turned on, but if someone happens to have it turned off, the will probably get filtered out as a spam bot (but for people struggling with large amounts of form spam, it's a small price to pay).