AJAX does not compete with XForms !

Tue 06 September 2005 By nuxeo

I've read and heard several time things like "XForms is not ready, let's use AJAX", "Why use XForms instead of AJAX?", "AJAX is simpler than XForms", "Let's do AJAX now and XForms later", etc.

Well I really don't think AJAX should be considered as a competitor of XForms. They don't address same issues and offer same features. They are complementary, not competitors !


AJAX stands for Asynchronous Javascript And Xml. It's more a new approach of web applications than a new technology (in fact it's several old technologies &#8212HTTP, HTML, Javascript, DOM and XML). AJAX applications are web application that use the browser as an UI framework: client-server paradigm using HTTP as transport, Javascript as language and XML as format. XML is not really important, actually, since it's possible to use other format (like JSON or YAML) which avoid the XML parsing cost. AJAX allows developer to create web applications that don't reload the page after every action but instead load and modify dynamically a part of the page.

The most important point in AJAX is the capacity of delivering very reactive and dynamic web applications to the user. And for developer, it allows to think web applications as applications and user interface not as chain/flow of HTML pages.


XForms is a new standard authored by the W3C that aims at replacing HTML forms and... a lot more ! :-) Basically, it's a new XML format to create any forms. Not just plain forms, actually, but highly dynamic forms (for example, a calculator) with style and fancy graphics. XForms uses other W3C standard like XHTML, XML Schema, XPath, CSS and SVG.

XForms offers a model to create active forms, where field can react to event and communicate each other. It becomes easy, with this model to disable the whole form when clicking on OK or activating a field when another field becomes valid, or even add lines to a "grid-like" form clicking on a button. In short, XForms allows to create very active and inter-active form-based UI.

I won't explain XForms in detail here... the important point is that XForms rocks! ;-) More details can be learned from the W3C XForms page.

So, XForm or AJAX?

Well, both technologies (if we can say technology for AJAX) can provide highly active forms. But I think they don't compete. XForms is usefull for forms and UI form-based. AJAX is just about interactive UI. The crucial advantage of XForms over AJAX for forms management is its platform independence. XForms can theoretically run on any platform (not only a web browser), while AJAX is limited to the browser.

Let's imagine a web application that can also be used from rich client (using, let's say Eclipse RCP ;-). Eclipse could run the form and communicate with the server. The form itself could look list any other form of the client system. XForms could with this approach provide a convenient format to integrate deeply web and desktop (rich) applications, blurring the limit between pure web applications and pure desktop ones.

AJAX is, on the other hand, very useful to create dynamic interfaces using drag and drop and can complete XForms in the browser to provide dynamic UI, when forms are not involved. For example XForms is perfectly suited to create a portal management (see CPSSkins) or a webmail (see gmail or CPSMailAccess) user interface. AJAX (Javascript to be more precise) can be used in the browser as Java is used in Eclipse RCP and both can consume XForms forms. I am now dreaming about an XForms implementation that could run XForms enabled forms using the SWT toolkit inside Eclipse RCP. In the browser, an AJAX-enabled player would read same forms. Those form would directly come form my web application and be read in my Eclipse RCP application or in my web browser. Some XForms AJAX-enabled players are currently on the way (see FormFaces).

I really think that we should use XForms as much as possible for all forms of our web applications and use AJAX for the rest of the UI in the browser.

Technorati Tags: , , , , ,

(Post originally written by Eric Barroca on the old Nuxeo blogs.)

Category: Product & Development