[forms] How to prevent robots from automatically filling up a form?

Decided to add another answer, sorry.

We use a combination of two:

  1. Honeypot field with name="email" (already mentioned by other answers) just be sure to use a sophisticated way to hide it , like moving off the screen or something. Because bots can detect display:none
  2. A hidden field that is set by JavaScript when the user clicks (or focuses if you want to be TAB-friendly) on a required field (wasn't mentioned in other answers)

The 2nd option can even protect from a headless-browser type of spam (using phatnom.js or Selenium) because even JavaScript-bots don't bother actually clicking textboxes.

Blocks 99% of bots.

PS. Make sure to use the focus trick only on fields that are not being filled by password managers like LastPass or 1Passwor.

For the same reasons - mark your honeypot with autocomplete="false" tabindex="-1"