XForms

March 30, 2006 by Oliver
Filed under: Programming, Technology, Web Programming 

Although I haven’t been writing much about programming and computers lately, I have still been reading.

XForms is another thing, like Mono, that I found out about quite a while ago that has recently resurfaced as possibly useful. XForms is a whole rethink about how information should be collected and sent of the web. The keyword here is information. HTML forms don’t really send information, they send data. There is no real structure to what is sent – all you have is name/value pairs (although depending on the capabilities of the server you can at least send variable length arrays with the foo[] naming convention).

XForms improves on this by separating forms into different parts, primarily models and user interface (well technically what I’m referring to as models is split into abstract models and instances but that’s like talking about classes and objects). The models are just chunks of XML that are sent to the page. The user interface (essentially just input tags like the HTML equivalents) modifies this XML and then sends it back.

The structuring of the data may well be enough to warrant the adoption of XForms, but it’s a little better than that. When I say the XML (or more correctly the model) is modified by the user interface, the modifications are held in memory by the client (probably a browser) and any references to the model should change accordingly. This allows some stuff that would usually require clever AJAX, complete calls to the server or at least just plain JavaScript can be done fairly trivially.

There are a lot more possibilities, this really is just the tip of the iceberg. To find out more, search for XForms :P

There is a problem though, support in browsers. You can get a plugin for IE6 that handles XForms but requires the page include the plugin. You can get an extension for Firefox that handles it “natively”. Neither work that well and when I tried it neither worked properly with a page intended for the other (IE obviously couldn’t use a page without the plugin and the plugin stopped the XForms working for Firefox). But the same was true (if not worse) for JavaScript when it first came out.

XHTML, ECMAScript

Comments

5 Comments on XForms

  1. Mark Birbeck on Sun, 9th Apr 2006 12:02 pm
  2. Hi Oliver,

    Great to hear of your interest in XForms!

    One quick thing though, on the plug-ins you referred to. I’m not sure why you said “neither worked that well”, since the IE6 plug-in (formsPlayer) is a full implementation of XForms and is used in many real-life applications, and the Mozilla plug-in is adding features at a fair rate of knots, and can already be used for many ’serious’ forms.

    Also, the presence of the object/import tags for IE6 shouldn’t affect Mozilla’s behaviour.

    It might be worth, therefore, double-checking your forms and if you have found bugs I know that both the Mozilla team and us here at formsPlayer would be grateful to hear about them.

    Thanks!

    Best regards,

    Mark

    Mark Birbeck
    CEO
    x-port.net Ltd.

    http://www.formsPlayer.com/

  3. Oliver on Mon, 10th Apr 2006 10:57 am
  4. http://www.formsplayer.com/community/samples/

    None of the examples I tried worked in Firefox, I just get “FormsPlayer has failed to load! Please check your installation.” at the top and a lack of any sort of inputs in the page.

    http://www.mozilla.org/projects/xforms/samples/calc_svg_1010.xhtml
    http://www.mozilla.org/projects/xforms/samples/tax_form/TaxForm.xhtml

    These pages on the other hand display fine in Firefox (although obviously not in IE because of the missing formsPlayer code).

  5. Allan Beaufour on Tue, 18th Apr 2006 2:10 pm
  6. That’s because the samples are served as “text/html”, which is wrong. It should be “application/xhtml+xml” as it is not HTML but XHTML. If you right click on one of the examples and choose “View Page Info”, you can see the type.

    The XForms Extension for Firefox does not “kick in” if the document is not handled as XML.

    We’ve included some “troubleshooting tips” here:
    http://developer.mozilla.org/en/docs/XForms:Form_Troubleshooting

  7. Oliver on Tue, 18th Apr 2006 2:24 pm
  8. Ahh. I blame the developers of formsPlayer then for allowing the content type to be ignored… :P

  9. Erik Bruchez on Mon, 1st May 2006 6:12 pm
  10. Olivier, good to see that you like XForms!

    But please be sure to check out Ajax-based XForms implementations before you complain about the lack of XForms implementations: those make sure that you do not depend either on plugin installs or browser support, and that you can simply upgrade a piece or server-side code to upgrade your XForms support!

    In particular, you may want to check Orbeon PresentationServer (OPS), an open source Ajax-based XForms engine:

    http://www.orbeon.com/software/get-excited

    Also, we are giving a talk on the tight relationship between XForms and Ajax at the XTech conference in a couple of weeks:

    http://xtech06.usefulinc.com/schedule/detail/133

    This may be of interest to you!