Client-side validation checks form data before submission, helping users catch mistakes and reducing unnecessary or potentially unsafe requests. It does not replace server-side validation, which remains essential. section 6.1.6 section 6.7
Use browser features first, then add guidance where users need it:
- Use native HTML attributes such as required, type, and pattern for built-in constraints and submission blocking. section 6.1.6
- Make errors clear and actionable: identify the problem and explain how to fix it, such as showing the expected email format. section 6.1.6
- For more specific messages, combine native constraints with JavaScript’s Constraint Validation API. Native messages may be insufficient for complex fields, and long forms can require repeated submissions to find errors. section 6.1.6
<label for="email">Owner’s Email</label> <p id="email-error">Error: Enter the email address in the format name@example.com.</p> #A <input id="email" name="email" type="email" aria-invalid="true" #B aria-describedby="email-error"> #C
Pair an email input with an error that states the expected format and is programmatically associated with the field. section 6.1.6







