Why XForms might be a Winner

This entry is part of the series:
Rethinking Web Forms with XForms

mgm develops several large scale web applications containing hundreds of forms, e.g. the e-government portal ElsterOnline Portal. Design, implementation, test, and maintenance of these forms implies significant effort. We are currently evaluating different technologies – including XForms, Wicket and JSF (ICEfaces) – that could help us to reduce these efforts, to improve quality and set the framework for our next generation web forms-centric applications.

For many enterprise web applications, HTML forms are a critical challenge. Java-based enterprise web application are typically built on server-side frameworks like Struts, JSF (ICEfaces) or Wicket which only provide very basic form controls. On the other hand, advanced RIA frameworks like ExtJS do require a lot of error prone JavaScript code.

A New Perspective on Web Forms

In the old days HTML forms were very easy to create. It was simply a matter of writing a few HTML tags. But those forms provided very little interactivity and the server-side processing was cumbersome. Current Java web frameworks tend to encapsulate everything into Java objects, making web forms programming similar to desktop GUI development. The downside of that is that rather low-level Java code has to be written and that the resulting application is tied to the web framework and its programming model.

This screenshot is taken from an evaluation project done for one of our clients. It shows how to build nice-looking layouts with XForms. We will describe how we built this form in one of the next articles.

From that perspective, XForms could provide the best from both worlds. This W3C standard allows building simple forms – very similar to HTML forms –, but also provides a powerful document model for implementing complex interactions and data validations. All communication is done via XML documents, which allows using complex data structures and is not tied to a specific programming language or architecture.

The MVC architecture of XForms

Here are some examples that can be accomplished very easily with XForms:

  • Repeating structures: for instance, adding items to a shopping basket or adding items to an expense declaration.
  • Wizards: exposing successive parts of a form without returning to the server.
  • Multiple submission: submitting results to different servers.

Browser support and Implementations of XForms

Similar to HTML, XForms is basically just a document format for defining input controls, data structures, and validation rules. Since current browsers do not understand XForms, these documents have to be handled by an XForms processor which can be implemented in various ways:

  • Server-side: The XForms processor is implemented as a server application which transforms all functionality related to XForms to something the browser understands (i.e. HTML+JavaScript). – Orbeon, Chiba, betterFORM
  • Browser Plug-in: The XForms processor runs within the browser and is implemented as a plug-in/extension or requires the installation of a plug-in (e.g. Flash/Java). – Mozilla XForms, IE FormsPlayer
  • JavaScript: The XForms processor runs inside the browser and is implemented in JavaScript. – EMC Formula

I’ve added a list of the XForms implementations that we have evaluated. In a later article we will comment in detail on our experiences with three selected XForms processors: Orbeon, Chiba, and the EMC Formula XForms Engine.

XForms Implementation Type
AJAXForms Client-side (Javascript)
betterFORM Server-side (JEE)
Chiba Server-side (JEE)
DENG Client-side (Flash)
EMC Formula XForms Engine Client-side (GWT)
FormFaces Client-side (Javascript)
formsPlayer Client-side (Browser-Plugin)
Mozilla XForms Client-side (Browser-Plugin)
MozzIE Client-side (Browser-Plugin)
Orbeon Server-side (JEE)
Ubiquity formsPlayer Client-side (Browser-Plugin)
Ubiquity XForms Client-side (Javascript)
XSLTForms Client-side (XSLT+Javascript)

The W3C also has a extensive list of all XForms implementations. A huge source of information about XForms and its implementations is the Wikibooks page on XForms.

Long Term Perspective with XForms

In the long term, we hope to be able to leverage specific features of XForms to allow approaches that are currently very hard to achieve:

  • Closer involvement of business departments in the form definition and testing process. Because most aspects of XForms are document-centered, they could be built or generated from an abstract, high level specification. This could help in reducing repetitive work in the development department and in increasing agility in the business departments.
  • Building different versions of a form from a single source document. XForms processors can provide forms for typical web applications as well as for desktop or mobile applications.
  • Dramatically decreasing latencies for high scale web applications. If we had a mature XForms processor running within a browser (either as a plug-in or a JavaScript implementation), server roundtrips would only be necessary for reading or submitting data.

In the next part of this series we’ll have a look at a small XForms application running on the Orbeon XForms engine.

Series Navigation<< Test-driving XForms with OrbeonPortlets with XForms in Liferay >>