Using the HTML5 Forms API

  • Forms should still be encapsulated in a <form> element where the basic submission attributes are set.
  • Forms still send the values of the controls to the server when the user or the application programmer submits the page.
  • All of the familiar form controls—text fields, radio buttons, check boxes, and so on—are still present and working as before (albeit with some new features)
  • Form controls are still fully scriptable for those who wish to write their own modifiers and handlers.


HTML Forms vs. XForms


You may have heard references to XForms in the last few years, long before the HTML5 effort gained much traction. XForms is an XML-centric, powerful, and somewhat complex, standard for specifying client-side form behaviour that has been developed in its own W3C working group for nearly ten years. XForms harnesses the full power of XML Schema to define precise rules for validation and formatting. Unfortunately, no current major browser supports XForms without additional plugins.

Functional Forms

HTML 5 Forms has instead focused on evolving the existing, simple HTML Forms to encompass more types of controls and address the practical limitations that web developers face today. There is an important note to keep in mind, especially as you compare form implementations across different browsers.
For example, while the specification details the functional APIs for elements such as color and date pickers, number selectors, and email address entry, the specification does not state how browsers should render these elements to end users. This is a great choice on multiple levels. It allows browsers to compete on innovate ways to provide user interaction; it separates styling from semantics; and it allows future or specialized user input devices to interact in ways that are natural to their operation. However, until your targeted browser platforms support all the form controls in your application, make sure you provide enough contextual information for the user to know how to interact with a fall back rendering. With the right tips and descriptions, users will have no trouble with your application, even if it falls back to alternate content when presented with unknown input types.
           HTML 5 Forms encompasses a great number of new APIs and elements types, and support for them is all over the map now. In order to wrap our heads around all the new functionality, we will address it by breaking it into two categories:
  1. New input types
  2. New functions and attributes

However, before we even start with that, let’s take a quick assessment of how the HTML 5 Form specifications are supported in today’s browsers.
 Note: The most important concept to grasp about HTML 5 Forms is that the specification deals with functional behaviour and semantics, not appearances or displays.

No comments:

Post a Comment