Skip to content
Tutorials Center
My learning

Topics

Lesson 24 of 37 ยท Forms, Ecommerce and Apps

Form Validation and Spam Protection

Validate form input and stop spam in Wix and Webflow: built-in rules, CAPTCHA, honeypot fields, rate limits and custom checks, with runnable validators and a spam scorer.

Open forms attract two kinds of trouble: honest mistakes (a mistyped email) and dishonest traffic (bots posting links to scam sites). Validation protects your data quality; spam protection protects your inbox. Both platforms give you building blocks, and both let you go further with custom code.

Wix and Webflow run on their own servers, not here. The runnable examples are labelled stand-ins that show how validation and spam scoring work in principle. They are not the platforms' real filters, and a real site should use the platforms' own protections as the first line.

Built-in validation

Both builders lean on the browser's native checks:

  • Required fields stop an empty submit.
  • Type checks: email must look like name@host, tel, url and number are checked or shaped by browsers.
  • Min/max length and patterns: HTML supports minlength, maxlength and pattern. In Webflow, you can add these as custom attributes on a field in the element settings; Wix Forms exposes length and format options in the field settings.
  • Number ranges: min, max and step.

Native validation is only a convenience for honest users, because anyone can bypass it by sending a request directly. That is why you must treat the server side as the final check. On hosted builders the platform's backend does basic checks; if you forward data elsewhere (to a CRM, a spreadsheet, your own API), validate again there.

Writing a good validator

The same rules work in custom code. Here is a validator stand-in: it returns specific, friendly messages for each problem.

JS Stand-in: field validators

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Spam protection options

Layered defenses beat one big wall.

  1. reCAPTCHA or similar. Webflow lets you add Google reCAPTCHA to forms through the form settings (you supply your site and secret keys). Wix Forms includes spam protection and the option of a CAPTCHA-style check in the form settings. A visible challenge reduces spam but adds friction, so use it when bots are a real problem.
  2. Honeypot field. A hidden extra field that real users never see or fill. Bots fill every field they find, so any value in the honeypot marks the submission as spam. It adds no friction for humans. Build it with a field hidden by CSS (not display: none only, since some bots skip such fields; positioning off-screen is common) and tabindex="-1" plus autocomplete="off", and make sure screen readers skip it (aria-hidden="true").
  3. Time check. People take several seconds to fill a form. A submission arriving in under a second is almost certainly a bot.
  4. Content rules. Block messages with many links, certain keywords, or all capital letters. Be careful: aggressive filters flag real customers.
  5. Rate limiting. Limit repeated submissions from the same source; platforms handle this on their servers, and you can add it if you use your own backend.
  6. Double opt-in for newsletters: send a confirmation email and add the address only after the click.

A spam scorer stand-in

No single signal is reliable. Combine them into a score and pick a threshold. The stand-in below scores a submission and shows how the honeypot and timing do most of the work.

JS Stand-in: score a submission

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Reducing false positives

A filter that blocks real customers costs money. Good habits:

  • Keep a review folder (or the platform's spam tab) instead of silently deleting.
  • Test your own form with a plain and a link-heavy message.
  • Watch the ratio: if more than a few percent of real submissions get blocked, loosen the rules.
  • Offer an alternative contact method (a visible email or phone number), so a blocked person is not stuck.

Accessibility of validation

  • Place error messages next to the field and describe how to fix the problem.
  • Do not rely on color alone; add text or an icon.
  • Move focus or announce errors so screen reader users know something failed. Native browser validation does this by default, which is another argument for using the platform's form fields rather than replacing them with custom widgets.

Common mistakes

  • Trusting client-side validation as a security measure.
  • Using only a CAPTCHA and ignoring the honeypot and timing signals.
  • Overly strict phone or name patterns that reject real people (names with apostrophes, hyphens or non-Latin letters).
  • Forgetting to test the form after adding a CAPTCHA, which can break layout on mobile.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Why can client-side validation not be your only protection?

    Anyone can send a request without a browser, so the server must check data as well.
  2. 2. What is a honeypot field?

    A value in the hidden field reveals an automated submission.
  3. 3. A submission that arrives 1 second after the page loaded is probably

    Humans need several seconds to fill in a form, so a near-instant submit is suspicious.
  4. 4. Which is a good error message?

    A specific message tells the visitor exactly how to fix the field.

Summary

  • Use native types, required flags and length rules for friendly validation, and check again on the server side.
  • Combine defenses: CAPTCHA when needed, a honeypot, a timing check, content rules and review.
  • Aim to block bots without blocking real customers; keep a way to review borderline cases.
  • Make error messages specific and accessible.

Next: Ecommerce: Products and Checkout