You can do an impressive amount of form validation with just HTML attributes. You can make the user experience pretty clean and clear with CSS selectors. But
Jakub Strojewski shows how to accumulate errors in a simple Validation use case