HTML and CSS Reference
In-Depth Information
C H A P T E R 4
Form Mastery
In Chapter 2 we took a glance at what is new in web forms. Now it is time to turn our
attention to them in more depth. Well, let's be honest, if that was said with excitement in
many circles, even web-related ones, it may well be met with chuckles over the absurdity
of getting excited over web forms. In the past, forms have been relegated to a unpleas-
ant corner of web development, the domain of those interested in the finicky nit-picking
of radio button groups, text input widths, and option-laden drop-down menus. Where's
the sexy design and rich interactivity? But perhaps more importantly, where are all the
form input types that should be there that instead needed to be hacked together using
JavaScript? Form markup has been with us for many years, appearing at least as early as
the HTML 2 specification, and has not changed in any remarkable way since then. It will
be a relief to know then that in HTML5 the light has been cast on them, and they have
grown into a capable set of input-handling HTML. Added are a capable new set of form
input types, form elements, and attributes, as well as new methods for interfacing with
JavaScript and CSS. With HTML5 a lot of functionality that had to be built in other ways
is now given for free. Now that is exciting!
I begin this chapter by working through the available form markup, examining new
features added to forms in HTML5 (and there are a lot), how best to use the different
types of form controls, and how to enhance usability and accessibility with simple struc-
tural markup. We'll dissect a complete form and then finish off with some big-picture
thoughts in regard to web form usability and related concerns.
Form markup refresher
In essence, forms are quite simple—they allow the user to input some data at one end
and then send that data on to the other end to be dealt with by a form handler. A form
handler typically means a script that processes the incoming form data, which is written
in a server-side programming language or framework such as PHP, Python, or ASP.NET.
Search WWH ::




Custom Search