My previous articles discussed how to use the existing web infrastructure to submit XML documents. The examples revolved around using the HTML form elements that were processed suitably on the server side into an XML tree by Active Server Pages or a Java class. But what if I told you that "soon" there will be a technology available that allows us to submit XML data directly to the server without using even one line of the code we previously discussed? This article introduces the World Wide Web Consortium (W3C) Markup Working Group's current proposal to introduce XForms and explains how it's likely to simplify the interaction between a web infrastructure and a device like a browser on your workstation. I'll also discuss what resources are available for you to find out more about this set of standards.
Before We Begin: Why Do We Need "Another" Forms Technology?
HTML forms need no introduction. They're pervasive on the webfrom the airline tickets that you search for on Expedia to the next DMV appointment that you schedule online. They're being used to collect information or to allow searching of information all over the web in very innovative ways. Every interaction that we have with a web site that provides dynamic content uses HTML forms in some shape or form. The ubiquitous <FORM> element, along with its range of radio buttons, check boxes, text boxes, select lists, and text areas, is found on almost every site on the web.
Even though HTML's <FORM> element has become so successful, it suffers from the lowest-common-denominator syndrome for its controls. Despite the number of years that the technology has been in common use, we don't have a slider control, a gliding scale to represent continuous values, a drag-and-drop for widgets, or other GUI elements that we take for granted in other user interfaces.
Also, it's fairly challenging for developers to deal with devices other than a web browser on platforms other than a workstation or a PC. Handheld devices that have similar interaction needs use a stripped-down version of HTML and HTML forms. Companies like Everypath are good examples of business models that provide services to enable web sites for handheld content, by acting as a translation layer between handheld devices and the actual web site.
Another challenging aspect for HTML form-based applications is forms that span multiple pages. For example, suppose you apply online for some insurance. Based on the questions that you answer on the first page of the form, you're provided with a series of questions on subsequent pages until you finish the application process. Typically, this interaction and flow is handled in one of the following ways:
Cookies are saved on the user's browser, containing some of the content from previous pages or the unique identifier of the user's session, which binds it to some session-information table. This session table may be persisted in the memory of the server (usually a bad programming practice) or a temporary table, which allows the information to be built on the final submit.
An easier approach is typically to hide this information as hidden form fields. As the user goes from one step to the next, the corresponding data is a payload that piggybacks on the HTML form of the next step. This continues until the final submit, when the hidden data from all the previous steps is finally committed to the application.
Needless to say, each of these approaches can be reasonably challenging.
Developers have been creating applications that are based on content-scrapping from other services or that involve interaction of two machines, by using HTTP web interfaces to exchange XHTML information. The applications rely heavily on predefined mapping templates and are prone to lot of parsing errors because any change in structure of one site affects the interaction between the two systems.
Keeping in mind the above limitations of the current HTML-based infrastructure, a subgroup of the W3C Markup Working Group has proposed XForms to improve human/machine and machine/machine interaction.