Codelab: Form Validator

Build a real form validation system from scratch using everything you've learned about functions.

Step 1 of 7

Build a real form validator with functions!

Every website with a sign-up form needs validation — checking that the user filled in their name, entered a valid email, and chose a strong password before submitting. In this codelab, you'll build a form validator from scratch on your own computer. You'll create validation functions like `isNotEmpty()`, `isValidEmail()`, and `isStrongPassword()`, then connect them to an HTML form. This is exactly how real-world form validation works behind the scenes.

Web Standard
HTML5 has built-in form validation attributes like `required`, `type="email"`, and `minlength`. These are great for simple checks, but JavaScript validation gives you full control over custom rules, error messages, and the user experience. Most real websites use both: HTML5 validation as a first line of defense, and JavaScript for detailed checks.