Form validation?

Is form validation obsolete new the HTML5 came out with the use of the new pattern attribute and the required attribute?

Thanks…

As there are still a lot of web browsers out there that don’t support these features, form validation is still alive and well! Hopefully in time, as these dinosaur browsers wither and die, we will reach a stage where we can ignore server-side validation for most forms. Of course, we may still need to use some server-side validation to prevent malicious use of the form, as relying on client-side validation means that it would be possible for people to circumvent it if they were so minded, so we will never be able to guarantee that client-side validation will work 100%.

Pattern is also limited compared to what you can do with Javascript.

Also the error messages, especially with pattern, are very limited. You’ll want to write better ones than what the browser comes up with :slight_smile:

Except that you should be making it clear before people type anything what the requirements of the field are, so they shouldn’t have to wait for the error message to tell them what they’ve done wrong!

Well and have you seen the error messages for pattern? They don’t tell you what you did wrong! :slight_smile:

I waver between placeholder-like things for patterns versus an aria-describedby linked p with further explanation. Sometimes it can fit in the label (dd-mm-yyyy) but other times not.

Not is ever obsolete, per say. Form validation is EASIER IN HTML5… but can you be sure every visitor is using an HTML5 capable browser?? So what about those who arent?

Going back to the HTML5, it’s really easy to customize the validation functions ( but yeah, it requires some simple .js and a a HTML5 capable browser)

It requires JS anyway… so might as well have full control and use JS entirely.

In the end it’s only there for one reason: help push users into filling out the right information in the right format in the right field the first time. Back-end validation does the real validation anyways.