Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Build a shopping cart application using XForms

XForms essentials to get started creating real-world XForms applications

Steve K Speicher (sspeiche@us.ibm.com), Senior Software Engineer, EMC
Steve Speicher is an IBM Senior Software Engineer working on emerging standards, both infrastructure based and industry verticals (healthcare). He is a member of the W3C Compound Document Formats Working Group, he led the development of the Compound XML Document Toolkit, and he uses Model-Driven Development (MDD) to improve the development of standards. He has previously worked on change and release management tools in the Rational division and in IBM internal tools.
(An IBM developerWorks Contributing Author)
Keith Wells, Advisory Software Engineer, EMC
Keith Wells is a software engineer at IBM in Research Triangle Park, N.C. Mr. Wells has been involved with Emerging Technologies and the Emerging Technologies Toolkit for several years. Currently, he is exploring opportunities with compound documents, model-driven development, software standards, and XML-based technologies.
Jan J. Kratky, Senior Software Engineer, EMC
Jan Joseph Kratky, the development lead for the XML Forms Generator and Visual XForms Designer, is a member of the W3C XForms Working Group. A Sun Certified Java Programmer and Sun Certified Web Component Developer, Mr. Kratky has worked with Java technologies since 1997 and with Eclipse technologies since 2001. He is currently a software engineer with IBM Emerging Software Standards in Research Triangle Park, N.C.
Kevin Kelly, Senior Technical Staff Member, EMC
Kevin E. Kelly is an IBM senior technical staff member who works on emerging software standards for the Web and the healthcare industry. Mr. Kelly is chairman of the Worldwide Web Consortium (W3C) Compound Document Formats (CDF) Working Group, member of the W3C Hypertext Coordination Group, and has been a member of the W3C XForms Working Group. He is also a member of the Health Level 7 (HL7) organization and works on Service Oriented Architecture (SOA) initiatives in HL7 and the Object Management Group (OMG). His focus is on developing open standards-based technologies for faster, more efficient standards adoption through XML-based and model-driven technologies.

Summary:  This tutorial focuses on key aspects of the W3C XForms 1.0 standard to produce a fully functional Web-based shopping cart. With this approach, the reader will get a good start at creating real-world applications with XForms, without having to learn the entire XForms specification.

Date:  12 Dec 2006
Level:  Intermediate

Activity:  8543 views
Comments:  

Before you start

About this tutorial

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.

About XForms

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.


Objectives

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.


Prerequisites

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

System requirements vary for this tutorial as there are a number of both viewing and authoring environments that are valid.

Viewing

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.

Editing and validating

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.

1 of 8 | Next

Comments



Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=XML, Web development
ArticleID=183062
TutorialTitle=Build a shopping cart application using XForms
publish-date=12122006
author1-email=sspeiche@us.ibm.com
author1-email-cc=dwxed@us.ibm.com
author2-email=wellsk@us.ibm.com
author2-email-cc=dwxed@us.ibm.com
author3-email=kratky@us.ibm.com
author3-email-cc=dwxed@us.ibm.com
author4-email=kekelly@us.ibm.com
author4-email-cc=

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.