Friday, February 11, 2005

Server-Side XForms

The Mozilla project recently announced the first beta version of their XForms support for the Mozilla and Firefox browsers.

As the W3C puts it, XForms is the next generation of web forms. It aims at replacing HTML forms within XHTML, as well as providing other languages such as SVG the ability to handle forms.

XForms was largely intended by its authors to run on the client, that is, within a web browser, as HTML forms do today. It offers benefits such as:

  • Clear separation between the data captured and the presentation (separation of concerns).
  • Flexible, structured XML-based data model. Define your data model as an XML document, then create forms accessing the data.
  • Built-in facilities for validation and data integrity based on XML Schema and/or assertions.
  • Requires much less, or no scripting at all for many common scenarios that do require scripting with HTML forms. In other words, XForms's approach is very declarative.
  • Ease of internationalization.
  • Support for a variety of devices.

As we know, after Netscape succumbed to Internet Explorer back in the 90s, client-side web browser technologies have largely stalled. The theory is that Microsoft, with a market share of over 90% of the installed web browsers base, does not see any point in making any improvement at all. After IE 5, Internet Explorer hasn't had any serious upgrade. With that spirit, Microsoft has said it wouldn't support XForms. In fact, Microsoft has also its own competing proprietary technology to push: InfoPath.

The good news is that while all this has been going on, the Mozilla project has not rested on its laurels and has produced an ever more solid browser, culminating with the release of Firefox 1.0 just a few months ago, a milestone on the path to a much bigger market share.

The Mozilla XForms beta is important, because it announces the day where Firefox will be fully XForms 1.0 compliant. Developers can play with a beta and get their hands on the technology. You can look forward to the day where XForms-based applications can at last be freely deployed on the intranet, where the browser environment is controlled.

But there is still a major issue, which is that if Microsoft doesn't come back on its decision not to implement XForms, it still won't be possible to deploy XForms on the web - that is, unless you don't care about users being able to access your site or web application. As much as we like to see Firefox's market share grow, it has yet to reach 10%.

This is why it is important today to closely look at server-side XForms implementations, one of which is provided by the open source Orbeon PresentationServer today.

The idea behind a server-side XForms implementation is quite simple: instead of requiring the web browser to interpret the XForms tags, software running on a server does it. To do so, it typically looks at XHTML and XForms documents, and transforms them into good old HTML and JavaScript. When the web browser submits an HTML form, the server-side software, again, transforms the submission to make it look to the application like it was submitted by an XForms engine.

The huge benefit of this approach is that almost every browser currently deployed can now render XForms, while the application developer does in fact write XHTML and XForms. It also opens the possibility for XForms-enabled web browsers to fully benefit from XForms, while legacy browsers use the server-side implementation.

To be fair, there are some drawbacks. For example, a promise of XForms is to reduce the number of roundtrips to the server. With a server-side implementation, this may not be easily achieved. Also, some features of XForms may take time to be implemented by such server-side implementations because they are harder to implement than on the client-side. PresentationServer aims at implementing eventually all of the XForms specification. The list of implemented features is available here.

In spites of those drawbacks, this approach is in some people's opinion the only way XForms will be able to be widely deployed on the web in the fairly short-term future. So go ahead and give PresentationServer a try!


  1. Just a few comments ;-) ...

    * Client side XForms on IE might not be that far away, at least through plugins (some are already available, other will come). The interoperability of all these implementations is still to be shown, but if the Mozilla announce is so important that's not only because it's a native implementation but also because there is no XForms plugins for Mozilla.

    * We wouldn't be fair to Orbeon PresentationServer by focusing too much on its XForms implementation. Of course, that's a very cool feature to have, but even if we could rely on client side XForms, there would still be a need for a framework such as OPS. XForms isn't meant to cover web applications at large and web publication frameworks will be most needed to define the glue that's needed between XForms and the underlying infrastructure. That's why I believe that using OPS is the best way to prepare a smooth transition between server side and client side XForms.

    * WordPress looks cool, but what about a blog system powered by OPS (and of course XForms)? I think that if whole application modules were available for OPS, that could be an additional competitive advantage for OPS and a blog module seems like a good start :-) ...

    All that being said, I heartfully agree that XForms is the next generation of web forms and OPS the way to make it happen today!

  2. Yes, it would be cool to have a blog powered by OPS + XForms, and not difficult in principle (although you quickly get to the point where you need to support many features). If there are volunteers out there to start, please go ahead! We can discuss the architecture of it on ops-development or ops-users. We could base it on eXist.