Ein Honeypot in das Kontaktformular einbauen ist recht einfach. Man kann alles am Feld hinterlegen:
form:
name: contact-form
fields:
- name: honeypot
label: "Leave this field empty"
type: text
attributes:
style: "display: none; position: absolute; left: -9999px;"
validate:
required: false # Sicherstellen, dass das Feld nicht ausgefüllt werden muss
message: "Bot detected!" # Fehlermeldung, falls das Feld ausgefüllt wird
rule: empty # Das Feld muss leer bleiben
buttons:
- type: submit
value: Send
Man kann auch eine Rule in
user/plugins/form/form.yaml[anlegen] und die rule anstelle von "empty" angeben. Wenn man mehrere Formulare auf der Seite hat, ist das sicher die bessere Methode.
rules:
honeypot:
message: "Bot detected!"
validate: empty
Comments are disabled for this blog-entry.