AIAIO: Our Blog

AIAIO: Our Blog

The pulse of Alexander Interactive

Dramatically Reduce Form Submission Spam With A Hidden Field

You’ve set up your site and its contact form and you have started getting traffic. Then one day the person getting the contact requests forwards you a spam submission:
“We are getting tons of these. Is there a fix our web guy can implement?”
Your immediate response may be to install a captcha. That will work, although it is a bit much for a simple contact form.
An alternative solution is to simply include a hidden field.
hidden-field.pngIn your css file add:
#email2 { display: none; }
In your contact form add:
<input class="text" type="text" name="email2" id="email2" />
Finally, in your server side processing script add logic to the effect of:
if request.POST.get('email2','')=='':
    #process form

And that is it. This will trick the spam bot to think that there is an extra email field in your form that needs to be filled out. It will automatically fill it out and submit the form. By filtering any form submissions that have this extra field entered, you can exclude the non-human submissions.

Technology

2 Comments

  1. Unfortunately, this does not address accessibility for low vision users.

  2. for low vision, u could put a legend in there that would tell them to leave the field blank

Leave a Comment

* = required