So, what can you do if you have to support browsers that don't have support for form validation yet?One option is to not do anything and rely on your server-side validation only.

server side form validating numbers-44

The bad news is that it is only partially supported in Safari, and isn't supported at all on i OS Safari, or the default Android browser.

If you need to support older versions of IE prior to IE10 you won't find any of those support form validation either.

They also help with accessibility, as the text in the label will be read out to screen reader users: it can therefore be useful to indicate required fields by adding ‘required’ to the label text, as I’ve done above.

I’m also using the WAI ARIA attribute now, so if we leave ‘required’ in the label tag screen reader users will have ‘required’ read to them twice, which they could find rather annoying.

Strictly speaking, you should make sure you're using the HTML5 DOCTYPE, otherwise you'll run into HTML validation errors.

But the great thing about them is that they all degrade gracefully.

So if an older browser doesn't support them, the fact that they're in the HTML won't 'break' anything, they’ll just be rendered as an .

NB While client-side form validation is great for enhancing user experience—fast, instant feedback to the user without making a round trip to the server—you will still need to validate any data submitted on the server, too.

Required fields can use the Now, in addition to showing the help text when the input field receives focus, we'll also show the help text when the input field's value is invalid.