diff --git a/forms.html b/forms.html index b6b3f7d..0123a71 100644 --- a/forms.html +++ b/forms.html @@ -424,6 +424,16 @@

Color Pickers

And One More Thing...

+ + + + + + +
Form validation support
IEFirefoxSafariChromeOperaiPhoneAndroid +
·4.0+5.0+6.0+9.0+·· +
+

In this chapter, I’ve talked about new input types and new features like auto-focus form fields, but I haven’t mentioned what is perhaps the most exciting part of HTML5 forms: automatic input validation. Consider the common problem of entering an email address into a web form. You probably have some client-side validation in JavaScript, followed by server-side validation in PHP or Python or some other server-side scripting language. HTML5 can never replace your server-side validation, but it might someday replace your client-side validation.

There are two big problems with validating email addresses in JavaScript: @@ -442,7 +452,7 @@

And One More Thing...

error message on invalid type=number field -

Unfortunately, no other browser supports automatic HTML5 form validation yet, so you’re going to be stuck with script-based fallbacks for a little while. +

Other browsers are slowly implementing support for HTML5 form validation. Firefox 4 will have complete support. Unfortunately, Safari and Chrome have shipped an incomplete implementation that may trip you up: they validate form controls, but they don’t offer any visible feedback when a form field fails validation. In other words, if you enter an invalid (or improperly formatted) date in a type="date" field, Safari and Chrome will not submit the form, but they won’t tell you why they didn’t submit the form. (They will set focus to the field that contains the invalid value, but they don’t display an error message like Opera or Firefox 4.)