XForms, much
like XHTML 2.0 which is currently under development as of November
2006 and within which XForms will be embedded, differs from previous
versions of XHTML. Because of this there is a learning curve for
developers, but because XForms in general provides a large time
savings for the development of enterprise quality web forms, it
can be an attractive alternative for many uses.
XForms 1.0 (Second
Edition) was made an official W3C Recommendation on 14th March 2006.
An indispensable list of errata to the 1.0 specification is available,
fully incorporated into the main specification as of the Second
Edition. XForms 1.1, which introduces a number of improvements,
is in progress as a W3C Working Draft as of November 2006.
Differences
from HTML forms
Unlike
the original HTML forms, the creators of XForms have used a Model-View-Controller
approach. The "model" consists of one or more XForms models
describing form data, constraints upon that data, and submissions.
The "view" describes what controls appear in the form,
how they are grouped together, and what data they are bound to.
CSS can be used to describe a form's appearance.
An XForms document
can be as simple as an HTML form (by only specifying the submission
element in the model section, and placing the controls in the body),
but XForms includes many advanced features. For example, new data
can be requested and used to update the form while it is running,
much like using XmlHttpRequest/AJAX except without scripting. The
form author can validate user data against XML schema data types,
require certain data, disable input controls or change sections
of the form depending on circumstances, enforce particular relationships
between data, input variable length arrays of data, output calculated
values derived from form data, prefill entries using an XML document,
respond to actions in real time (versus at submission time), and
modify the style of each control depending on the device they are
displayed on (browser versus mobile versus text only, etc.). There
is often no need for any scripting with languages such as JavaScript.