Introducing XForms

XForms is the next generation of HTML forms that is richer and more flexible than the HTML forms. XForms is the forms standard in XHTML 2.0. The platform and device independent XForms enables the separation of data and logic from presentation. XForms that uses XML to define forms data, stores and transports data in the XML documents. The XForms is a W3C recommendation that provides some important features like calculations and validations of forms. In addition, the XForms reduces or eliminates the need for scripting which in turn saves a lot of time and effort. Of course, these methods could be implemented by any professional letter writer (and finished successfully).

In today's world, the forms have become an important part of many web applications. The web applications use an HTML form to accept input from a user. Ten years after HTML forms became a part of the HTML standard, web users nowadays perform complex transactions that are not possible with the standard HTML forms. XForms provides a richer, more secure, and device independent way to handle web input. Considering all these factors, the future web solutions need to support XForms and involve in developing XForms-enabled browsers. XForms uses XML for data definition and HTML or XHTML for data display. XForms separates the data logic of a form from its presentation. This way the XForms data can be defined independent of how the end-user will interact with the application.

In XForms, the rules for describing and validating data are expressed in XML. In addition, in XForms, the data displayed in a form are stored in an XML document, and the data submitted from the form are transported over the internet using XML. The data content is coded in, and transported as Unicode bytes. The separation of data from the presentation makes XForms device independent, as the data model can be used for all devices. You can customize the presentation for different user interfaces such as mobile phones, handheld devices, and Braille readers for the blinds. As XForms is device independent and is based on XML, you can add XForms elements directly into other XML applications such as VoiceXML, Wireless Markup Language, and Scalable Vector Graphics.

An HTML form is used to collect data from the users. The XForms are also used for the same purpose. In XForms, input data is described in two different parts which include the XForms model and the XForms user interface. The XForms model defines the type of the form, the data contained in the form, and the action performed by the form. The XForms user interface defines the input fields and the method of display of the input fields. Now let us see both the XForms model and the XForms user interface one by one with an example.

The XForms model is used to describe the data. The data model is an instance of an XML document. The XForms model defines a data model inside a <model> element:


<submission id="basicform"

In the example above, you can see that the XForms model uses an <instance> element to define the XML template for data to be collected, and a <submission> element to describe how to submit the data. The XForms model has nothing to do with the visual part of the form, i.e., the user interface.

The XForms model uses an <instance> element to define the data to be collected. XForms is used to collect the data for an XML document. The <instance> element in the XForms model defines this XML document. In the above example, the data instance which is the XML document for which the form collects the data is as follows.


When the collection of data is over, the XML document is as follows


The XForms model uses a <submission> element to describe how to submit the data. The <submission> element defines a form and the way in which the form needs to be submitted. In the above example, the attribute id="basicform" identifies the form, the action="one.asp" attribute defines the URL where the form should be submitted, and the method="get" attribute defines the method to be used when submitting the data.

The XForms user interface is used to display and input the data. The user interface elements of XForms are called input controls. The syntax to display the user interface for entering the first name and last name and to submit the same is as follows.

<input ref="firstname"><label>First Name</label></input>
<input ref="lastname"><label>Last Name</label></input>
<submit submission="basicform"><label>Submit</label></submit>

In the example above, the two <input> elements define two input fields. The ref="firstname" and ref="lastname" attributes points to the <firstname> and <lastname> elements in the XForms model. The <submit> element has an submission="basicform" attribute which refers to the <submission> element in the XForms model. A submit element is normally displayed as a button. In XForms every input control element has a required <label> element.

An XForms Processor built into the browser enables you to submit the XForms data to a target. The data can be submitted as XML. The data that is submitted can be as follows.


The user interface elements in XForms are called XForms Controls. The most commonly used controls elements are <input> and <submit>. Each control element has a ref attribute. The XForms user interface does not describe the way in which the XForms controls need to be displayed. As XForms is platform and device independent, only the browser is involved in the display of controls. As a result, the XForms can be used for all types of devices such as personal computers, cell phones, hand held computers, etc. XForms is also the perfect solution for defining user interfaces for people with disabilities such as handicapped and blind.

SetApp - 100 Apps for everything you ever wanted to do on Mac

FREE Subscription

Subscribe to our mailing list and receive new articles
through email. Keep yourself updated with latest
developments in the industry.


Note : We never rent, trade, or sell my email lists to
anyone. We assure that your privacy is respected
and protected.


FREE Subscription

Stay Current With the Latest Technology Developments Realted to XML. Signup for Our Newsletter and Receive New Articles Through Email.



Note : We never rent, trade, or sell our email lists to anyone. We assure that your privacy is respected and protected.



Add to My Yahoo!

Visit XML Training Material Guide Homepage



“Amazon and the Amazon logo are trademarks of, Inc. or its affiliates.”

Copyright - © 2004 - 2019 - All Rights Reserved.