Home > Articles

Implementing Xforms on Your Site

  • Print
  • + Share This
XForms is the newest form-creation technology, separating the purpose of a form from its presentation within the web browser, and thereby giving the web developer more power and flexibility for creating really useful forms. In this article, Earl Bingham describes some of the basics you'll need to know to implement XForms on your site.
Like this article? We recommend


Because they're the primary means of communication between a web site and its users, HTML forms are an important part of a web site. The next stage of development of HTML forms is a fairly new standard named XForms, "...a new platform-independent markup language for online interaction between an XForms processor and a remote entity."1

HTML forms have many limitations. Currently there is no relationship between HTML forms and XML. HTML forms are device-dependent, not supporting screens of small and very large sizes. There is a mixture of purpose and presentation that is difficult to manage if a different look-and-feel is required, and there is a limited accessibility of features. As the W3C states:

The current design of web forms doesn't separate the purpose from the presentation of a form. XForms, in contrast, are comprised of separate sections that describe what the form does, and how the form looks. This allows for flexible presentation options, including classic XHTML forms, to be attached to an XML form definition.

XForms is planned to be a part of the XHTML 2.0 specification.


The primary source for information on XForms is the www-forms mailing list. To subscribe, send an email to www-forms@w3.org with the word subscribe in the subject line (include the word unsubscribe if you want to unsubscribe).

The XForms Model

The first important concept in XForms is the XForms model, a single device-independent XML form definition that can be plugged into various presentation options, including XHTML, WML, or other proprietary user interfaces. Following is a sample XForms model:

<model xmlns="http://www.w3.org/2001/12/xforms" id="Person">
  <instance xlink:href="http://example.com/cgi-bin/get-instance" />
  <schema xlink:href="Schema-Questionnaire.xsd" />

The XForms User Interface

The second concept is that of the XForms user interface, which provides a standard set of visual controls that are targeted toward replacing today's XHTML form controls. These form controls are directly usable inside XHTML and other XML documents.

XML Instance Data

The third concept is that forms collect data, which is expressed as XML instance data. The XForms model describes the structure of the instance data. Forms normally represent a structured interchange of data, while workflow, auto-fill, and pre-fill form applications are supported through the use of instance data.

Here is an example of an <instance> element:

   <my:line name="a">
   <my:line name="b">
   <my:line name="c">
   <my:line name="d">

The XForms Submit Protocol

The fourth concept is the need to have a channel for instance data to flow to and from the XForms processor. To accomplish this, the XForms submit protocol defines how XForms send and receive data, including the ability to suspend and resume the completion of a form.

  • + Share This
  • 🔖 Save To Your Account