Saturday, June 25, 2005

Ajax-Enabled XForms

Ajax-Enabled XForms

There does not appear to be an end to the Ajax craze, witness the amount of activity reported by Of course, Ajax does not solve all the problems of the world, and it comes with a series of new problems of its own.

For those who missed the boat, Ajax is a way of letting lightweight scripting code in a web browser communicate with your web server by exchanging XML documents. The net result is that you can create web applications that are more "rich" and responsive than traditional web applications, yet do not require plugins, Java, Flash, or even insane amounts of Javascript on the client. Google Maps is one of the most popular examples of this technology.

Yet implementing Ajax is not trivial. There are some Ajax libraries out there, but they usually concentrate on offering platform-independent support for interacting between client and server, and a few other goodies. They no not address the questions of:

  • How you create on the client the XML data to send to the server
  • What you do on the client with the XML data returned by the server
  • How the server processes the XML data it receives and how it builds a response for the client

In short: Ajax remains a very low-level tool.

But now look at what people use Ajax for:

  • Improved HTML widgets (such as dynamic drop-down lists)
  • Displaying data dynamically provided by the server as the user interacts with the application
  • Modifying the appearance of the current page dynamically

If you are in the know, you just want to say: "Have you heard of XForms?" Because yes, those are some things that XForms allows you to do:

  • Use several widgets much improved over their HTML versions, including novelties such as sliders and repeated sections
  • Submit XML data and receiving new XML data back, thanks to the replace="instance" submission
  • Dynamically modify the appearance of a page by hiding and showing parts of it, by repeating sections of the form, or by updating selection lists

There is of course a little problem, which is that XForms is currently not widely availble in web browsers. You are forced, at the moment, to use plugins or incomplete server-side implementations. But what if you had... an Ajax-based XForms implementation?

The answer to that "what if" scenario is quite exciting: much of the need for coding low-level Ajax is removed with an Ajax-based XForms implementation (or a full client-side implementation, for that matter). Of course XForms may not do everything you may want to do with Ajax, but it does a good deal already. With extensions, which are easy to provide if like Orbeon PresentationServer (OPS) you have a server-side XForms implementation, you can build more advanced functionality on top of XForms.

So we haven't been sleeping at Orbeon: our next generation server-side XForms engine, part of OPS, is Ajax-enabled, not only because it's a cool technology, but because it makes our XForms implementation just better and because it opens doors so far closed to everyone but the hardcore Ajax developer.

We hope to have a beta of the new XForms engine very soon, likely in early July. But if you are impatient, you can always download the latest unstable builds of OPS or get the source from CVS, and you can follow our latest developments there. Look in particular at the new Calculator and XForms Controls, as well as the Translate This and the updated sandbox examples.

NOTE: We discuss the whys and the therefores of Ajax-enabled XForms in our recent XTech paper .

No comments:

Post a Comment