XForms as the Basis for Web Applications

Steven Pemberton, W3C/CWI


Although XForms[1] has emerged from an analysis of HTML Forms, and is intended as a replacement of them, in fact it is much more than that: it is an application description language. At present only a few developers have spotted this (for instance [2]), but gradually more and more examples are emerging (such as Windows Task Bar applications based on XForms [3]).

The point is, XForms has a powerful memory model, an input/output model, a calculation model, and a presentation model, all based on Web technologies, and none of this is necessarily tied to the principle of submission to a server. Furthermore, while scripting is possible in combination with XForms, often it is not necessary because of XForms's declarative approach; spreadsheet-style applications are trivially easy with XForms.

Memory Model

The XForms memory model is one or more 'instances' (basically XML documents), either created inline or loaded from an external source, where input, output and calculations 'bind' to individual values in the instances. While any suitably powerful memory model is theoretically equivalent, an advantage of the XForms approach is the ease of initialising the memory from external sources: from files, URLs, SOAP, XML RPC, queries etc, and the ease of saving the memory between invocations, providing a simple mechanism for persistence.


XForms input/output controls are deliberately abstract, expressing their intent rather than the exact way that they are to be presented on the display. This approach has proven to be extremely powerful, especially supporting device independence and accessibility. Demonstrations have already been given of the same XForms application being run on a PC, a PDA, a cell phone, a voice browser, and even being run via a command line. Other implementations such as XSmiles[4] and FormsPlayer[5] have demonstrated how to bind XForms controls to other markups, such as SVG.


XForms provides an extensible, declarative calculation model (similar to, but more powerful than, the model used in spreadsheets). People who understand the power and simplicity of declarative programming can thus easily take advantage of this; those who prefer to use procedural styles can still do so via scripting. XForms has a powerful event mechanism, using XML Events, that is used in such a way that often scripting is not needed in order to handle events.


XForms uses CSS as the basis for its presentation model. The single weakness of CSS, that you can't reorder elements doesn't apply to XForms, since it has a reordering mechanism in its binding from instance to output.


The advantages of using the XForms approach as a basis for applications are all the benefits that XForms have: integration with XML and other web technologies, device independence, accessibility, ease of authoring, internationalization. The memory model in particular provides a strong basis for powerful and easy to author applications. FInally it offers the best of both worlds: it is amenable to both declarative and procedural approaches.


[1] XForms

[2] The Secret Life of XForms

[3] FormsPlayer task bar application

[4] XSmiles

[5] FormsPlayer