HTML Form Validation Not Working
Quick summary
Your required, pattern, or type-based validation is not working because the form or inputs are misconfigured.
Why this happens
The input is missing the required attribute
The form has novalidate attribute which disables validation
The button is not type='submit' — it does not trigger validation
Custom validation interferes with native validation
Minimal example
<form novalidate>
<input type="email" name="email">
<button type="button">Submit</button>
</form>
<!-- novalidate disables validation, button type="button" does not submit --><form>
<input type="email" name="email" required>
<button type="submit">Submit</button>
</form>Remove novalidate, add required, and use type='submit' to enable native browser validation. The browser will prevent submission and show messages for invalid fields.
How to diagnose
Check the form for novalidate attribute
Verify the submit button has type='submit' (or is a button inside the form)
Inspect inputs for required, pattern, and type attributes
Test by submitting the form empty — does the browser show validation messages?
How to fix
Remove novalidate from the form element
Ensure the submit button has type='submit'
Add required, type='email', or pattern attributes to inputs
Call form.reportValidity() if validating programmatically
How to prevent
Use native HTML5 validation attributes (required, type, pattern, min, max)
Test forms in multiple browsers — validation UI varies
Related Resources
Related Lessons
- HTML Forms
Learn HTML forms.