bestkungfu weblog

Mozilla and XForms

Filed in: accessibility, tech, Web, Wed, Aug 11 2004 16:02 PT

Mozilla will support XForms, according to a press release on the Mozilla site today.

Good. It’s a huge improvement for developers and users alike.

The big question everybody was asking on Slashdot today was: why can’t we just use HTML 4 and JavaScript? To me, that’s like a carpenter asking why they need a nail gun, when their caveman’s club pounds nails just fine. Sure, you can do a lot of the stuff XForms does using JavaScript. You could submit a form to a hidden image to prevent reloading the page. You could validate form values on submit, or even on blur. You could create output in XML data, or even SVG, if you’re so inclined.

But only if all of your browsers support JavaScript, and only if you debug it everywhere. If somebody has JavaScript turned off, either they can’t submit because you attached the submit to a script that won’t fire, or you’re going to have to re-validate the data on the server side.

So let’s say for the sake of argument that you can do what XForms does with nasty JavaScript kludges. Why would you prefer that over something that’s designed to do what users and sites want? Why would you want to write and debug the same JavaScript methods over and over again each time you do a new form?

And why wouldn’t you want the interface to be standardized everywhere? As it is, all you have in JavaScript to draw attention to invalid information is alert(), confirm(), and focus(). There is no standard means whatsoever for highlighting invalid data, or directing users to correct it. (Which in my mind is something that should have been in there as soon as it became clear HTML was becoming an application platform, but that just shows how perfect my hindsight is.)

Then there’s the accessibility problem. If you’re the user of assistive technology, and you get caught up in a poorly-implemented scripted form, you are, as my grandfather used to say, shit out of luck. And in this respect, almost all forms out there meet my criteria for poorly-implemented. We didn’t need the millionth implementation of JavaScript forms validation, and we don’t need the ten-millionth. Validation is a part of the XForms spec, and all processors will be able to convey error conditions and constraints to all clients in a manner that best suits them. You can’t do that in JavaScript. That’s a clear win, and it’s going to mean a lot for usability and accessibility when XForms is more broadly supported.

One more thing: to all Web developers who are complaining about having to learn another language, well, feel free getting left behind. If you’re not willing to read up on XForms, or at least Web Forms 2.0, you should have been out of this business three years ago.

4 responses to “Mozilla and XForms”

  1. Ian Bicking says:

    Arguing that Javascript is sometimes turned off is a little silly. Javascript support is certainly much better than XForms support. A concerted effort to enhance browsers through Javascript is also likely to be much faster and more effective than XForms. Javascript is flawed, but not hopelessly flawed. Building a form through Javascript is flawed, but Javascript can be written to work off a reasonably semantically-correct markup of a form.

    Of course that’s what Web Forms 2.0 is doing, and I think that effort is great. Javascript has the power to do good error reporting, using things like XMLHttpRequest and the DOM. You can even utilize arbitrary server-side programming, and encapsulated Javascript libraries to do it. Javascript isn’t eternally doomed to be used for one-liner and ad hoc scripts, or to be hardcoded into the markup.

  2. Matt May says:

    It is not silly at all to argue about JavaScript being turned off. A large number of people I work with have it turned off, not because of any security fears, but because their assistive technology doesn’t work with it. As for XForms support, there’s already an XForms plugin for IE out there, and XForms players that work (without massive debugging) in more scenarios (think mobile phones) than JavaScript does today.

    JavaScript cannot do good error reporting, because it can’t do it semantically. Neither HTML nor DOM has the functionality to communicate an error state unambiguously. XForms has that, too.

    As for JavaScript still being useful, well. JavaScript is effectively the only language out there for scripting Web clients. But just because it’s the only way doesn’t make it the best.

    There comes a time when you have to stop treating the symptoms and attack the source of a problem. The problem here is that forms need to be checked before they’re processed by the server. JavaScript can pretend to solve that, while dropping mini-problems here and there. XForms solves it by design. This is a good thing. Good!

  3. Ian Bicking says:

    While Javascript isn’t the solution, I’m saying it can be used to build a solution. If there is some standard — even ad hoc — about how to semantically represent an error message, Javascript can be used to produce that semantic result. It’s not Javascript’s fault that no such standard exists, and semantics are just agreed upon ideas. Such a standard could be build on HTML or Javascript quite easily. It could be as simple as formElement.reportError('You must enter a value') where reportError was added onto the form elements of current browsers, or implemented independently by accessible browsers.

    Javascript is a mechanism by which HTML forms can be incrementally improved. XForms just doesn’t offer that. People who develop publically-used web forms aren’t going to be using XForms anytime in the forseeable future (though for intranets it has more potential). XForms is ignoring the reality of web development. And maybe it’s all fine and well for other kinds of development, as a terminal replacement, or for closed networks — both valid targets — but that’s not the world wide web.

  4. karl dubost says:

    Ian could you tell us how do you define the reality of Web development, because if I remember my years of Web development, I heard sentences like : “CSS is ignoring the reality of web development.” So I would like to understand why you are inclined to say such things.

    I think XForms has a great potential on the Web and not only Intranets as you said and I do not put the border between Intranet and the Web with regards to the use of technology, but more with regards to the access rights. Someone will prefer to reuse the same technologies, there’s a question of cost factor here.

Powered by WordPress (RSS 2.0, Atom)