Before you start
This tutorial takes a progressive approach to building an online shopping cart. As the shopping cart is built and new XForms concepts are used, they will be briefly described to allow general understanding of the end application.
The World Wide Web Consortium (W3C) has developed the XForms standard for the presentation and collection of form data. As stated in the W3C Recommendation, XForms is intended to be "the next generation of forms for the Web." XForms provides a number of advantages over existing HTML forms technology. As the Recommendation declares, "By splitting traditional XHTML forms into three parts -- XForms model, instance data, and user interface -- it separates presentation from content, allows reuse, gives strong typing -- reducing the number of round-trips to the server, as well as offering device independence and a reduced need for scripting." XForms is gaining in popularity as implementations continue to appear and existing ones improve. A wide range of client- or server-side processors, authoring tools, and workflow products now support the XForms standard.
This tutorial describes a general usage pattern for forms modification using XForms. See Resources for more developerWorks articles and other resources about XForms.
About the sample shopping cart
The tutorial focuses on a shopping cart that is used to purchase computer-related products. It computes totals, discounts, account for warranties, various delivery options, and is comparable to many existing shopping carts available on the Web today. It is not the intent of this tutorial to explore server-side processing of orders but to focus on client-side capabilities.
In this tutorial you learn some how to use some XForms constructs, enough to develop a useful shopping cart application. You will be able to understand the organization of a XForms document, use some XForms user interface controls, define restrictions on data model and some techniques on how to improve the appearance of the form.
This tutorial is written for Web application developers familar with HTML, HTML forms, XML, CSS and other related Web technologies. Though knowing these technologies would be helpful, they are not required to be able to gain a better understanding of XForms by using this tutorial.
System requirements vary for this tutorial as there are a number of both viewing and authoring environments that are valid.
In order to view or render these forms, typically a Web browser plus an add-on is needed. There are a few options that don't require add-ons; these are either server-based or JavaScript™/ECMAScript-based. See Resources for a list of some available XForms viewers. For this tutorial, Mozilla's XForms add-on 0.7 is used with Firefox 1.5.0.7, but many others will do just fine. It is not the intent of this tutorial to highlight differences in current implementations, but to provide enough information to develop forms that can be used with most viewers.
Authoring form content can involve any number of tools. The lists of tools include server-side template technologies, WYSIWYG editors, and simple text editors. Typically, many XML-based editors that provide design and source panes work quite well. It is additionally helpful to use content-aware editors that use associated schemata for guidance. See Resources for some available editors. For this tutorial, the Visual XForms Designer from alphaWorks® was used.

