An XForms Overview

Steven Pemberton, W3C and CWI, Amsterdam

Chair, XForms WG

What's new

Separation of content from presentation

Strong typing

XML Submission

Internationalisation

Accessibility

Device independence

Reduced scripting through declarative event handlers

Not a standalone document format

Separation of data from presentation

By putting details of the data in the head of the document and binding to controls in the body, the data collected is more obvious, and more reuse is possible.

<head>
   <xforms:model>
        <xforms:instance>
            <age/>
        </xforms:instance>
       <xforms:submitInfo action="/submit"
        method="post" id="sbmt" />
   </xforms:model>
</head>

in the body

<body>
...
   <xforms:input ref="age">
       <xforms:caption>How old are you?</xforms:caption>
   </xforms:input>
   <xforms:submit submitInfo="sbmt">
       <xforms:caption>OK</xforms:caption>
   </xforms:submit>
...

Strong typing

Optional use of Schema datatypes allows client-side checking.

<xf:model>
    <xf:instance href="/cgibin/get-values" />
    <xf:schema href="data.xsd" />
    ...
</xf:model>

XML Submission

Collected data can be sent to the server as XML instance.

<instanceData>
    <cc>MC</cc>
    <nr>12345678909</nr>
    <expires>12/01</expires>
</instanceData>

Internationalisation

Better support for character encodings.

Accessibility

Non-specific form controls allow use on accessible devices.

<caption> element present on all controls

<f:selectOne ref="cc">
    <f:caption>Credit card</f:caption>
    <f:choices>
        <f:item>
            <f:caption>Mastercard</f:caption>
            <f:value>MC</f:value>
        </f:item>
        ...

Device independence

Non-specific form controls ("selectOne", not "radio", etc)

Non-specific events ("activate", not "click", etc)

Reduced scripting through declarative event handlers

<f:button>
      <f:caption>Delete</f:caption>
      <f:delete ev:event="activate" .... />
</f:button>

Not a standalone document format

Needs a host

Different conformance levels to suit different sorts of devicesz

This was only a taste

There is more...

See w3.org/TR/xforms/