Introduction To XForms

Allan Beaufour

Presentation Overview

  1. The Rationale for XForms
  2. The XForms Language
  3. XForms Implementation Status
  4. XForms Samples

Part 1

Part 1

The Rationale for XForms

Definition of XForms

XForms is an XML application that represents the next generation of forms for the Web.
— XForms 1.0 Specification

Why a New Forms Standard?

Problems in Current Forms

Goals of XForms

XForms Benefits

Part 2

Part 2

The XForms Language

Hello Google (XHTML)

 <head>
  <title>Google Search</title>
 </head>
 <body>
  <form action="http://google.dk/search"
   method="get">
   <label for="i">Google:<label>
   <input id="i" name="q"/>
   <input type="submit" value="Search"/>
  </form>
 </body>
ex.

Hello Google (XForms)


 <head>
  <title>Google Search</title>  <xf:model>
   <xf:submission action="http://google.dk/search"
                  method="get" id="s"/>
  </xf:model> </head>
 <body>  <xf:input ref="q">
   <xf:label>Google:</xf:label>
  </xf:input>
  <xf:submit submission="s">
   <xf:label>Search</xf:label>
  </xf:submit> </body>
ex.

Seperation of Values and UI

Seperation of Values and UI

Diagram of the three parts in XForms

Instance Data

User Interface

XPath – Short Intro

XPath – Examples

<x>
 <y a="a">
  <z>_</z>      (1)
 </y>
 <y a="b">_</y> (2)
 <y a="c">_</y> (3)
 <y a="b">_</y> (4)
</x>

UI Example

<instance>
 <x>
  <y a="test1">value 1</y>
  <y a="test2">value 2</y>
  <y a="test3">value 3</y>
 </x>
</instance>
XForms examples:
<output ref="/x/y"/> --> value 1
<output ref="/x/y[2]"/> --> value 2
<output ref="/x/y[@a = 'test3']"/> --> value 3
In XForms, UI controls (except for <repeat>) is bound to the first element in a set
ex.

The Model

Model Item Properties (MIP)

<bind nodeset="[XPath]" MIP="[XPath]"/>
readonly
Can data only be read?
required
Is data needed for submission?
relevant
Is data relevant? (like enabled/disabled)
constraint
When is data valid?
calculate
XPath expression determines data contents _
ex.1, ex.2

Submit Parameters (excerpt)

action
URI for where data will be sent (http://, file://, etc.)
method
How will data be sent: XML, HTTP GET, HTTP POST
ref
XPath expressions determining which elements to send
replace
What happens with the returned data?
instance
Save returned data in an instance

Submission Benefits

XML Schema

XML Schema Types

XML Schema in XForms

ex.

XForms 1.0 Second Edition

Part 3

Part 3

XForms Implementation Status

Some XForms Implementations

Firefox XForms Extension

Firefox XForms Extension Status

Part 4

Part 4

XForms Samples

Samples

AJAX – Without The Scripting

Hotel Booking Summary

Part 5


Conclusion

Conclusion

More information

Presentation and Examples

This presentation is made entirely in XHTML and JavaScript, and runs in Firefox.

See it online here:
http://beaufour.dk/ctic/pres/U_Oviedo

You can contact me at: allan@beaufour.dk