Validating forms using html5
Figure 2 shows the Browsers that don’t support the placeholder attribute ignore it, so it won’t render.By including it, though, you’re providing an enhanced user experience for those users who have browser support and you’re “future proofing” your site.All modern browsers support Note: There is no official pseudo-class for styling placeholder text but both Mozilla (makers of Firefox) and Web Kit offer vendor prefixed properties for styling (-mozplaceholder and –webkit-input-placeholder).This makes it safe to assume that a pseudo-class will become standard for styling placeholder text.
In this article we’ll be focussing on the new attributes with a future article looking at the new input types. We’ll start with a (very) brief history of HTML5 forms though.
So with all of the boring technical guff out of the way, let’s get on with the interesting technical guff and take a look at some examples of form validation.
One of the most common patterns of validation is that of mandatory (that is, required) values — the fields that the user must complete in order to progress.
Traditional Java Script methods do, though, have some serious usability problems.
For example, if a user begins completing the form before the script loads, they will (jarringly) be returned to the first form field when the script is loaded.