RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


The Secret Life of XForms : Page 2

XForms recently reached the W3C's Candidate Recommendation status—and you need to know about it—because XForms isn't a form description language, it's a language for describing applications in a platform-independent way. Best of all, it integrates easily with technologies you already know, such as XHTML, XPath, SVG, and CSS.

XForms Is About Applications, Not Just Forms
It's worth emphasizing the idea that XForms technology is about applications, not just about forms. One of the most common misconceptions that people have about the W3C XForms recommendation is that its primary purpose is to generate forms, such as job applications, building permits, and so forth, with the tight layout ability implicit in such forms. That's an admirable goal, and it's one that XForms could potentially fulfill, but this focus on "forms" also causes people to miss the real point of the language (and illustrates the danger of choosing names poorly).

XForms is not necessarily a Web language, though there are a number of Web based XForms engines. Instead, it's a way to create an application that, with no scripting, can do such things as automatically reject invalid data, automatically update the contents of one control based upon changes in another, load content from external resources and send content to external URLs without leaving the application, retain state from one "page" to another, pass information into secondary dialogs, and so forth.

Envision XForms as an XML based language for the description of an application.
In other words, an XForms form is (superficially at least) similar to a Visual Basic Windows application or a Swing Java client program. However, because XForms is in essence an abstract representation of the application, it's not language-specific. It's entirely possible that you could use the same XForms document as the basis for a windowed application in either VB or Java, though doing that is beyond the scope of this article.

XForms provides an abstract conceptual model of the form, rather than describing a specific layout.
This abstract XForms representation takes place at a number of levels. The first, and most obvious, is the use of abstract controls to describe interface elements. Listing 1 contains a simple stock calculator. When you select a specific stock and enter a number of shares, the calculator determines the total stock price.

When rendered in a browser, the results look like Figure 1. I used the x-port formsPlayer plugin for Internet Explorer, so your application may look somewhat different.

Thanks for your registration, follow us on our social networks to keep up-to-date