Spread the love

Honeypot Anitspam Method is another invisible way to protect your form from bot spam, In this method, we place a hidden field that is invisible for humans but visible for spambots. by this method we trick Spambot. Spambot will think it’s a valid field and they gonna fill it out.

Now what we need to do is add the script on the form submission to check if the invisible field value is added and then stop the form from submission.

Let me explain by example:

Examples of Form codes:

<form id=”register_form” role=”form”><input name=”name” type=”text” />
<input id=”register_honey” class=”text” name=”register_honey” type=”text” />
<input name=”email” type=”email” />
<input type=”submit” value=”Submit” /></form>

CSS for making fields hidden

<style type=”text/css”>
display: none;

Script on form submission:

<script type=”text/javascript”>
if ($(‘input[type=”text”]#register_honey’).val().length > 0) {
alert(‘submit intercepted’);



Geometrical Web

× Chat Now