HTML and CSS Reference
In-Depth Information
for accessibility. The file control is a way to transfer files to the server,
and the Submit button is the most obvious way for the user to send the
entire form back to the server. This set of controls has existed mostly
unchanged since before forms were first added to the standard in 1996.
You can build Stef's sign-up form out of these rudimentary controls.
The figure shows Stef's form implemented using HTML4 form con-
trols. The full source code is available for download from www.manning
.com/crowther/ . If you're in the United States and wondering what a
postal code is, it's similar to a ZIP code—remember that Columbia
Internet is a Canadian ISP .
A lot of the ideas for HTML5 forms were taken from the XForms 2 proposal,
a partner standard in what was to be the XML based future of the web with
XHTML2 (see appendix A for more details).
_
But the HTML4 forms solution requires a number of compromises. It
uses text inputs for purposes such as numbers and email addresses. For
the rest of this chapter, you'll learn about the new form controls pro-
vided by HTML5 , which are more appropriate for such input.
Numbers, ranges, dates, and times
HTML5 introduces several new form controls that didn't exist in
HTML4 ; they give you more precise control over how you gather user
input. In HTML4 , all text inputs were just that: text. HTML5 signifi-
cantly expands the range of controls available, not least by providing
two ways of entering numbers and multiple controls for dates and
times. We'll look at these new controls for numbers, dates, and times in
this section.
Form submission
For a form to be useful in this scenario, there needs to be some server-side pro-
cessing to deal with the form values the browser sends when the user clicks Sub-
mit Query. We don't want to get bogged down in backend issues in this topic, so
Search WWH ::




Custom Search