Anti bot in the contact form

Hello !

I’m a beginner in grav cms and no native english (sorry for mistake).

In the contact form, i put an empty field and i like any message bot that fill thit field to go into trash (or something like). I already add in the frontmatter:

anti-bot:
  label: anti-bot
  placeholder: 'veuillez laissez ce champ vide'
  type: email
  validate:
    required: false

but it is not enought.

Can you help me ?
ps : I don’t want to use captcha

i change:

type: email

by

type: honeypot

this is enought?

@cvgrenoble, Have you tried it?

The anti-bot field don’t appear, seem to be how the honeypot work. But I don’t know if a bot will go in the trap.

using the example in grav form field index make the field appear and send the mail

fields:
    honeypot:
      type: honeypot

@cvgrenoble, I’m afraid there is misunderstanding on the concept of a honeypot field…

A honeypot is an <input> field which is invisible/hidden to a regular user. Most bots however don’t “look” at the displayed webpage, but instead interpret the generated HTML/DOM and search for <input> fields. If the bot then enters data in the honeypot field, the server will treat the posted form as spam.

I already understand how the honeypot work like you describe it :slight_smile:
but the example giving by grav form field index that I put just before don’t work (the field appear and if I fill it the mail is send).
The field don’t appear if I put:

anti-bot:
  label: Message
  placeholder: ‘Entrez votre message’
  type: honeypot
  validate:
    required: false

I remove the

fields:
   

in the

fields:
    honeypot:
      type: honeypot

that i use i example.
Now it’s look like this:

title: Contact
form:
    name: contact
    fields:
        name:
            label: Name
            placeholder: 'Entrez votre nom'
            autocomplete: 'on'
            type: text
            validate:
                required: true
        email:
            label: Email
            placeholder: 'Entrez votre adresse mail'
            type: email
            validate:
                required: true
        message:
            label: Message
            placeholder: 'Entrez votre message'
            type: textarea
            validate:
                required: true
        honeypot:
            type: honeypot

and it seem to be OK.

1 Like