Download
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

Documentation: Hide an e-mail address from a spam bot

#2468
Avatar photo[anonymous]
[anonymous] wrote:

One question however: I know that the code you gave is just an example but I think you have to leave out the code value=Y because otherwise the value Y is always send to the server. Instead, I think, you have to check if the value is not null?

Indeed you’re right. I did a little mistake. You can just check if the inout is or is not checked. You ca use a simple input too. just check the length of the value and if it’s not equal to zero, then prevent the form send.

Now the correct code :

$("form input[type='submit']").click(function (e) {
    var form = $(this).closest('form');
if ($("input[name='login']",form).is(':checked')) { // If honeypot is lit
        e.preventDefault(); // We don't send the form
        // Do something that looks as if the form was sent...
    } 
});