HTML and CSS Reference
In-Depth Information
to
<input type=text>
, legacy browsers that don't understand
the new extensions will fall back to the default and allow the
user to enter data in a plain text fi eld.
NOTE
The specifi cation makes no requirements on how browsers should
present the new input types to the user or report errors, etc. Different
browsers and different devices will present different user interfaces; compare,
for example, the different ways that a select box is shown on Safari on desktop
and Safari/iPhone (
Figure 3.1
).
FIGURE 3.1
The same select
box rendered in Safari/Windows
(left) and Safari/iPhone. Most
screenshots are from Opera,
as that has the most complete
implementation at time of writing
(May 2010), but where something
is implemented in another
browser, we use that instead.
The email input type
The markup
<input type=email>
tells the browser that it should
not allow the form to be submitted if the user has not entered
what looks like a valid email address—that is, it doesn't check
whether the email address exists or not, only whether it's in a
valid format. As with all input types, the user may submit the form
with this field empty unless the
required
attribute is present.
The manner in which the browser reports errors is not defi ned.
The (experimental) implementation in Opera 10.50 is shown in
Figure 3.2
.
FIGURE 3.2
An automatically
generated error message in
Opera 10.50.
The
multiple
attribute is allowed, which means that the value of
the fi eld can be a list of comma-separated valid email addresses.
Of course, this does not require that the user enter a comma-
separated list manually; a browser may perfectly well pop up a
list of the user's contacts from his mail client or phone contacts
list, with checkboxes.