Title: XFORMS in minutes
1XFORMS in minutes
2Presentation overview
- Introduction
- What Why
- How XFORM works
- Code examples
- Specific features
- Problems Issues
- References
3ltFORMgt is dead all hail the ltXFORMgt!
- XForms offers a higher level approach to writing
traditional XHTML form-based input. - Became a W3C recommendation in 2003
- Second edition of the spec released in Sept 2006
- XForms WG currently working on 1.1
4Why use Xforms?
- Clearer design
- Implements separation of concerns via a MVC
approach - data model independent from presentation
- logic easier to code
- Less code
- No javascript! ltscript/gt
- Works with existing technologies
- Designed with AJAX in mind
5Underpinning technologies
- XML
- XML Schema
- XPath
- DHTML
- HTTP
- Javascript
- Ajax
What you (as the developer) need to know What
the xform handling code uses
6How to do I produce XFORMS?
- XFORMS are all written in XML
- When executedXFORMS (D)HTMLJavascript
- Pre-compile source code ?
- Dynamic compilation on server ?
- Dynamic compilation on client (browser) ?
7XFORM implementations
- Pre-compilation
- AJAXForms
- XFormation
- Server support
- Orbeon
- IBM Workplace Forms
- Browser support
- X-Smiles
- Browser addons/extensions
- Mozilla XForms
- MozzIE
- FormsPlayer
- FormFaces
8Quotes
- XForms is the most-implemented W3C specification
ever at this stage in its life-cycle. W3C
XForms FAQ - British Government's e-government
interoperability framework current guidance is to
use the XForms standards as defined by W3C
9XFORMS MVC Approach
Model Define the format of the data
Controller Specify constraints and relationships
View Simply reference parts of the model
ltpatientgt lttitle/gt ltsex/gt ltdob/gt ltchildren/gt lt
/patientgt
10XFORMS MVC Approach
Model Define the format of the data
Controller Specify constraints and relationships
View Simply reference parts of the model
No empty nodes allowed String, max length 50
chars Enumeration (MaleFemale) Date
value Integer range0 lt x lt 10
ltpatientgt lttitle/gt ltsex/gt ltdob/gt ltchildren/gt lt
/patientgt
11XFORMS MVC Approach
Model Define the format of the data
Controller Specify constraints and relationships
View Simply reference parts of the model
No empty nodes allowed String, max length 50
chars Enumeration (MaleFemale) Date
value Integer range0 lt x lt 10
ltpatientgt lttitle/gt ltsex/gt ltdob/gt ltchildren/gt lt
/patientgt
12Show me some XFORMs!
- lthtmlgt
- ltheadgt
- ltxformsmodelgt
- ltxformsinstancegt
- ltpersongt
- ltname/gt
- lt/persongt
- lt/xformsinstancegt
- ltxformsbind nodeset"/person/name"
type"xsstring" -
constraintstring-length(.) lt 50"/gt - lt/xformsmodelgt
- lt/headgt
- ltbodygt
- ltpgtHello world. Please enter your name
here - ltxformsinput ref"/person/name/gtlt/pgt
- ltbodygt
- lt/htmlgt
13Show me some XFORMs!
- lthtmlgt
- ltheadgt
- ltxformsmodelgt
- ltxformsinstancegt
- ltpersongt
- ltname/gt
- lt/persongt
- lt/xformsinstancegt
- ltxformsbind nodeset"/person/name"
type"xsstring" -
constraintstring-length(.) lt 50"/gt - lt/xformsmodelgt
- lt/headgt
- ltbodygt
- ltpgtHello world. Please enter your name
here - ltxformsinput ref"/person/name/gtlt/pgt
- ltbodygt
- lt/htmlgt
14Referencing data with XPATH
- View and controllers reference data model with
XPATH expressionse.g. - ltxformsbind nodeset"" required"true" /gt
- /credit-card/number
- /credit-card/position() 1
- /credit-card/starts-with(local-name(),expiratio
n) - /credit-card/
15Binding attributes (validation)
- typeltxformsbind nodeset"/credit-card/expiration
-month" type"xsinteger" /gt - constraintltxformsbind nodeset"/credit-card/expi
ration-month" constraint". gt 1 and 12 gt
."/gt - requiredltxformsbind nodeset"/credit-card/expira
tion-month" required"true" /gt
16Binding attributes (cont)
- calculateltxformsbind nodeset"/person/age"
calculate"year-from-date (current-date()) -
year-from-date(../dob)" /gt - readonlyltxformsbind nodeset"/person/age"
readonly"if (../dob ) then false else
true" /gt - relevantltxformsbind nodeset"/person/password"
relevant"false" /gt
17View attributes
- ltxformsselect1Â ref"/moving-details/my-delivery-c
ompany" appearance""gt ltxformsitemset nodeset"
/companies/delivery"gt ltxformslabelÂ
ref"label"/gt ltxformsvalue ref"_at_value"/gt lt/xf
ormsitemsetgt - lt/xformsselect1gt
appearance"full" appearance"compact" appearance"minimal"
18Disadvantages of XFORMS
- Enhanced accessibility ?
- The abstraction that xforms offers means that you
need not worry so much about the presentation
issues - Reduced accessibility ?
- At the mercy of the xforms handler
- Can AJAX ever be made accessible?
19Did I mention its all XML?
- OH MY GOSH ITS ALL XML!!!!!!
- Not for the faint hearted (or people without a CS
degree!) - Editors should make this easier when they arrive
? - OpenOffice.org 2.0 already here
20References
- XForms 1.0 (Second Edition) W3C Recommendation 14
March 2006 - http//www.w3.org/TR/xforms/
- XForms 1.1 W3C Working Draft
- http//www.w3.org/TR/xforms11/
- Orbeon Forms
- http//www.orbeon.com/