XForms – The Coolest Little Technology You’ve Never Heard Of
The reason you have never heard of this sweet technology is explored in this post, Microsoft and XForms, Standards Assassin or Innovator?.
“Standards? Why Bother?” asked Bill.
XForms is a way of expressing data and business logic into an XML instance that you can embed into an XHTML file and run in your favorite browser (sort of). XForms essentially provides a complete MVC programming model complete with events and view binding available within an XML file. Wikipedia describes XForms thusly:
XForms is an XML format for the specification of a data processing model for XML data and user interface(s) for the XML data, such as web forms. XForms was designed to be the next generation of HTML / XHTML forms, but is generic enough that it can also be used in a standalone manner or with presentation languages other than XHTML to describe a user interface and a set of common data manipulation tasks.
Of course, an XML instance cannot do anything by itself, it merely represents potential for action. In order to execute the business logic and view represented in an XForm you need an XForm execution engine. Significant XForms engines fall into 2 camps, each with their own set of vendors and advocates. The different strategies are browser execution and server execution.
Browser Execution Engines
FireFox leads off with native support baked into the browser. This makes a convenient platform for a closed ecosystem like an enterprise document workflow application.
Additionally, plugins are available for IE and other browsers. The leading plugin for IE comes from formsPlayer, although Pico Forms is hot on their trail with a plugin in its 3rd beta.? Pico Forms also has a custom XHTML browser and promotes XForms in the mobile space.
The first is from the open source project FormFaces and has not seen active development since January of 2007. FormFaces implemetns much of the XForms specifications and as long as your application doesn’t need sliders to do range selections, this is viable option. The second is a forthcoming product from the plugin provider, formsPlayer. In exchanges with the CEO of formsPlayer I learned their implementation is close to done. I actually am hoping to see a demo next week.
These JS libraries provide the most realistic option for getting your XForm application to function on the web as no thick app requirements exist on the client.
In order to get the XForms to do something interesting, it is likely you will need to include some other dynamic content technology into your application. I have had some success in including the Yahoo UI AJAX library and triggering the AJAX controls using the data model event handlers. A model of this implementation is illustrated below.
Click the image for a larger version.
Server Side Engines
The idea here is that XForms are parsed and rendered into HTML on the server and subsequent changes to the embedded data model are managed by round tripping to the server. Sure this works, but it kind of takes all the fun out of it.
On November 29th, the W3C working group for XForms promoted XForms 1.1 specification to Release Candidate stage. This is really good news for vendors and developers embracing XForms technology because it represents a commitment to the technology by several leading adopters.
Although this technology is in its infancy, I strongly encourage you to take a look at it the next time you are asked to implement a dynamic forms application within your enterprise. After all, how many times must we reinvent this wheel?
For More Information
Some links I have found very useful in learning more about XForms are below: