XForms is the next generation of HTML forms. In this article, we would shortly discuss about the usage of XForms in the web applications. Prior understanding of HTML, HTML forms and XHTML is required.

XForms is richer and more flexible than HTML forms and it is platform and device independent. This concept separates data and logic from presentation and also stores and transports data in XML documents. It also contains additional features like calculations and validations of forms. Separating data from presentation makes XForms device independent, because the data model can be used for all devices. The presentation can be customized for different user interfaces, like mobile phones, handheld devices, and Braille readers for the blind.

The purpose of an HTML form is to collect data. XForms has the same purpose. With XForms, input data is described in two different parts:

The XForm model – defines what the form is, what it should do, what data it contains.

The XForm user interface – defines the input fields and how they should be displayed.

Consider an example of XForms model:

In the example above, the XForms model uses an instance element to define the XML-template for the data to be collected, and a submission element to describe how to submit the data.

An important element in the XForms is the instance element. The instance element defines the data to be collected. XForms is always collecting data for an XML document. The instance element in the XForms model defines the XML document.

In the example above the “data instance” (the XML document) the form is collecting data for looks like this:

After collecting the data, the XML document might look like this:

Although forms can also be formed with the help of HTML, but XForms provide a much more powerful and rich capabilities and options for web developers. In the future articles, we would discuss some more powerful features of XForms.

Looking for a quality hosting service? here are a few I suggest.
BlueHost | HostGator | Media Temple
Ali has been an entrepreneur in web, video and related technologies. Having worked with many business across the globe, Ali stands truly a great pillar in the business working with him.