XForms

Mark Birbeck's picture

Yahoo! uses XForms for 'write once, run anywhere' mobile applications

Yahoo! recently announced their entry into the mobile web applications space, with a service that allows applications to be built and hosted using Blueprint, a purpose-built mark-up language based on XForms.

The Blueprint roadmap describes the underlying philosophy:

Much of Blueprint's philosophy and syntax comes from XForms. We opted for a full declarative language because it was the only way we could effectively run on the wide range of devices out there, some of which have no scripting at all. By using declarative syntax, we can encapsulate and hide the scripting specifics. In some cases, the code could run on the phone, in other case, such as XHTML, we can put the logic on our servers. It's the perfect way to deal with the various environments and their capabilities.

At the moment Blueprint is simply converted to XHTML plus JavaScript for delivery to devices, but the mention of XForms gives a clear indication of where they are heading. And given that Google did something similar with the launch of its Google Mashup Language, it all bodes well for a new wave of web applications that won't be built using JavaScript (or even Java and GWT) but will use straightforward, device-independent, mark-up.

Write once, run anywhere, anybody?

For more on why XForms is Ajax on steroids, see:

How to harness the power of XHTML and XForms in your .NET applications

Code Project

Recently, we've had a number of enquiries about embedding formsPlayer inside third-party applications, as more people are realising the benefits of using XForms as a dynamic UI framework. Fortunately, formsPlayer exposes a set of COM interfaces explicitly for this purpose and a number of commercial solutions exist that are currently relying on them. With this in mind, I've posted a tutorial article to The Code Project, one of the leading .NET developer resources, which demonstrates integration of these interfaces in a simple C# browser-like application.

Although the tutorial is by no means comprehensive, I hope it provides enough detail for anyone interested in this area to quickly get themselves up and running. In due course, I'm hoping to expand the tutorial much further to encompass some of the cooler features we've implemented, including event-based communication with rendered documents and serialisation of rendered documents in their live state. To view the tutorial, click here.

Mark Birbeck's picture

What is XForms?

XForms is a relatively recent standard from the W3C, designed to allow us to create sophisticated user interfaces using mark-up. This means that defining a user interface is much the same as using HTML, except that XForms has been designed from the ground up to cope with many of the things that we usually have to dive into script to do.

And XForms doesn't just make it easy to replace script in our applications, it also provides us with the means to manipulate and validate XML; unlike most languages that you might have used, XForms brings XML right into the heart of the language.

Mark Birbeck's picture

Introduction to XForms

A key idea of our approach to building internet applications is making good use of standards-based languages, in particular XForms.

XForms is an exciting new language from the W3C that can be used to create anything from simple forms to complex Web 2.0 applications. XForms are dynamic, cross-platform, accessible, script-free...and 100% standard.

This handbook covers everything you need to know to get started with XForms. You'll start with a simple walkthrough to get your development environment up and running, then create two fully functioning applications--one that saves links to del.icio.us, and another that searches Flickr. Both use CSS-driven Ajax animations.

Once you've seen what XForms can do, building web applications will never be the same!

Different behaviour of repeat in 1.5 and later

Forms with xf:repeat may render differently in version 1.5 and later, compared to 1.4, this is due to a change in the relationship between repeat, repeat-item, and the document.

This can best be seen where the background-color of repeat-index or repeat-item differs from the background-color of the document. This is rendered as a strip of differing background colour over the entire width of the page, rather than being constrained to the apparent width of the repeat-iteration (i.e. the width of the contained controls and text), as it is in 1.4.

Controlling performance of switch and case.

formsPlayer 1.5.7 sees the introduction of new features to allow form authors to decide when the contents of a case element will load. This gives the form author finer control over the performance of an XForms document, by allowing them to choose whether to load some content at startup, or later on in the lifetime of a form instance. Until now, in 1.5 builds, the markup within a case element has been ignored until that case is first selected, giving potentially faster load times, but a slower reaction to the toggle action.

There are three new ways to ensure that a case element is ready prior to toggling into that case.

1. script

Mark Birbeck's picture

A toolbar for searching the Prototype API documentation

formsPlayer toolbar for searching Prototype API docs

A recent announcement that documentation for the Prototype Ajax library was now available was followed almost immediately by a rather neat looking desktop gadget and a Firefox sidebar. Not to be outdone, I decided to put together a toolbar for Internet Explorer, and managed to do the whole thing with one XForms form control and an action handler--and of course, no script.

Mark Birbeck's picture

Understanding the XForms dependency-engine

A key component of an XForms processor is the dependency-engine. The idea is pretty straightforward, and will be familiar to anyone who has used a spreadsheet; if some item has its value set by a calculated expression that contains references to other items, then when any of those items change, the first item must be recalculated. It's not necessary to understand the dependency-engine when programming XForms, but having some familiarity with how it works may help when structuring forms.

formsPlayer now supports Tablet PC pen input

formsPlayer

One of our customers in the insurance industry recently required us to provide proper Tablet PC stylus support in formsPlayer. The latest version implements our first cut of this feature, allowing hand-written data entry into the XForms input, secret and textarea controls.

Obtaining data from a submission that's in error

Some services return non-successful HTTP status codes, but still expect the client to respond to the body of the response. For example, a SOAP request to add a new customer to a database might return an HTTP 500 code to indicate that the customer already exists, but the actual body of the response might be perfectly usable XML.

Since XForms discards returned data when there is a submission error, and classes HTTP 500 as an error, we have introduced the instance-error attribute on submission.