Before you start
This tutorial is for developers investigating the use of XForms in real-world situations, rather than "toy" applications. It describes the use of XForms in creating two different accounting forms as part of the X-Trapolate accounting application. This tutorial assumes that you're familiar with the basics of XForms. No accounting knowledge is required.
In Part 3 of this series, you created a form to track the assets of your fictional company in terms of budgets, profit, and expenses. Here in Part 4, you are going to look at assets a little more literally.
Every business has assets, whether they are buildings, assembly-line robots, computers, or simple tools. Those assets must be purchased, maintained, and replaced at various intervals. In this tutorial, you will build a form to track user requests regarding assets. You will build one form for typical users, and another for the procurement users responsible for resolving such issues.
You will also build a form for reviewing orders. In both cases, you will see some of the kinds of issues that arise when you attempt to build an actual application. How do you combine information from separate database tables? What happens when the data is not structured to make your XForms functionality convenient? This tutorial explores those issues.
In the course of this tutorial, you will learn:
- How to create a master-detail form using XForms
- How to use nested switch/case statements to handle multiple situations simultaneously
- How to build an XML instance from multiple database tables
- How to automatically set "live" data such as the current date after a form has loaded
- How to build a single-value checkbox
The purpose of the series is to demonstrate the use of XForms in the development of realistic Web applications and to instruct the reader in the use of XForms.
- Part 1 is an introduction to the entire series summarizing all the portions of the end result and what facets of the XForms specification each part covers.
- Part 2 covers logging in and account management.
- Part 3 covers the development of forms pertaining to asset management.
- Part 4 continues the coverage of the development of asset management and reporting of various accounting aspects of a business.
- Part 5 covers liability management and more enhancements.
- Part 6 concludes the series with a summary of the developed tools, and some suggestions for improvement and further work for the tool set.
This tutorial uses a MySQL database for storage and reference. Necessary SQL commands appear throughout the article, but require a working knowledge of MySQL. PHPMyAdmin offers equivalent access to configure the MySQL database and view the entries from a menu-driven graphical interface.
Though the purpose of the series is to educate the reader about the use of XForms, some background is expected. There are some very good articles and introductory series concerning XForms available on from developerWorks (see Resources). XForms is built on XML, and, hence, a basic understanding of XML is also assumed.
Other technologies and concepts may also be involved, but they will be to a much lesser extent and should be inconsequential to the reader's comprehension of the topic.
The following software is required to follow along with this tutorial:
- A browser capable of displaying XForms, such as Firefox 2.0.1.
- A Web server with PHP enabled such as WAMP
- An SQL server, MySQL, which is part of the WAMP package in this case.

