HTML and CSS Reference
In-Depth Information
Less-common form controls
Numbers, dates, times, email addresses, and URL s—these are all fields
you're likely to need in nearly every form, but HTML5 doesn't stop
there. There are some additional form controls that you'll need either
less regularly or when you're building particular types of web applica-
tions. These controls so far lack implementations or common use cases,
but they may see more uptake in the future as HTML is used for more
desktop-style (or mobile) applications.
Telephone numbers
You don't often need telephone numbers in a
web app, but they're a common requirement
for things like credit card forms, so HTML5
has an input type for them:
Tel
Color <keygen>
4
20
1
4
~
1
<input type="tel">
10
~
~
But the format for a telephone number is
unpredictable. Phones tend to deal in strings
of digits, but people break them into inter-
national dialing codes, area codes, and local
numbers with spaces, brackets, and dashes.
9
11
3
4
~
1.2
What value can
these form fields have?
The tel type seems particularly
useless—it doesn't even
offer validation.
It's an accessibility
win—you can tell users what
type of information the field
expects even if the page
content doesn't make
it clear.
Surely
there's more
to it than
that.
It's also helpful in form
autofill functionality. The
browser can offer only email
addresses you've previously
used for email fields and
phone numbers for telephone
fields. Mobile browsers can
automatically insert your
own phone number.
My browser seems
to do pretty well
with that already.
But it's based on
guessing and heuristics.
The extra information makes
it more accurate.
Search WWH ::




Custom Search