Add a honeypot to forms

Hello,

I added a regular form block and all works well. Only issue is that I am now beginning to receive spam (unsurprisingly). I still want to avoid the Captcha to make it easier for my customers and want to try a honeypot first. I do not see a way to implement this with the current form dialogue.

Do you know of a way to implement a honeypot?

Appreciate any pointers.

One of the uses of @mnakalay’s Hidden Data Attributes for Express is to create a honeypot.

As an aside, I have a new forms system on the way that will include a honeypot form element.

Thank you @JohntheFish :slightly_smiling_face:

Since you’re using a regular form and not an Express form (if I’m not mistaken) you might want to try this instead:

It includes a honeypot and several other anti-spam techniques

Thank you for your responses.

Appreciate that and will keep it in mind. I was more looking for a way to code it myself. But then I might have posted this in the wrong board.

Again, thank you for your pointers.

Coding it yourself is doable, but you will have to override the form block’s controller or write a class to use concrete antispam architecture.

For the normal form block just create a block template that adds your honeypot field in the view.
Then, if you override the block’s controller, check for that specific input in the submit method.
To override the controller, you just put a copy of it in application\blocks\form and change the namespace to reflect the new location.

It’s not overly complicated if you know PHP.

If you don’t, you might want to consider ready-made solutions.