1 / 20

XFORMS in minutes

XFORMS in minutes. Chris Bailey. Presentation overview. Introduction What & Why How XFORM works Code examples Specific features Problems & Issues References. <FORM> is dead – all hail the <XFORM>!. XForms offers a higher level approach to writing traditional XHTML form-based input.

jennis
Download Presentation

XFORMS in minutes

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. XFORMS in minutes Chris Bailey

  2. Presentation overview • Introduction • What & Why • How XFORM works • Code examples • Specific features • Problems & Issues • References

  3. <FORM> is dead – all hail the <XFORM>! • 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

  4. Why 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! <script/> • Works with existing technologies… • Designed with AJAX in mind

  5. Underpinning technologies • XML • XML Schema • XPath • DHTML • HTTP • Javascript • Ajax… What you (as the developer) need to know What the xform handling code uses

  6. How to do I produce XFORMS? • XFORMS are all written in XML • When executedXFORMS (D)HTML+Javascript • Pre-compile source code  • Dynamic compilation on server  • Dynamic compilation on client (browser) 

  7. XFORM implementations • Pre-compilation • AJAXForms • XFormation • Server support • Orbeon • IBM Workplace Forms • Browser support • X-Smiles • Browser addons/extensions • Mozilla XForms • MozzIE • FormsPlayer • FormFaces

  8. Quotes • “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

  9. XFORMS MVC Approach Model: Define the format of the data Controller: Specify constraints and relationships View: Simply reference parts of the model <patient> <title/> <sex/> <dob/> <children/> </patient>

  10. XFORMS 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 (Male|Female) Date value Integer range{0 < x < 10} <patient> <title/> <sex/> <dob/> <children/> </patient>

  11. XFORMS 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 (Male|Female) Date value Integer range{0 < x < 10} <patient> <title/> <sex/> <dob/> <children/> </patient>

  12. Show me some XFORMs! Data model Control binding View <html> <head> <xforms:model> <xforms:instance> <person> <name/> </person> </xforms:instance> <xforms:bindnodeset="/person/name" type="xs:string" constraint=“string-length(.) < 50"/> </xforms:model> </head> <body> <p>Hello world. Please enter your name here: <xforms:inputref="/person/name“/></p> <body> </html>

  13. Show me some XFORMs! Data model Control binding View <html> <head> <xforms:model> <xforms:instance> <person> <name/> </person> </xforms:instance> <xforms:bindnodeset="/person/name" type="xs:string" constraint=“string-length(.) < 50"/> </xforms:model> </head> <body> <p>Hello world. Please enter your name here: <xforms:inputref="/person/name“/></p> <body> </html>

  14. Referencing data with XPATH • View and controllers reference data model with XPATH expressionse.g. <xforms:bindnodeset="…" required="true" /> /credit-card/number /credit-card/*[position() = 1] /credit-card/*[starts-with(local-name(),’expiration’)] /credit-card/*

  15. Binding attributes (validation) • type<xforms:bindnodeset="/credit-card/expiration-month" type="xs:integer" /> • constraint<xforms:bindnodeset="/credit-card/expiration-month" constraint=". >= 1 and 12 >= ."/> • required<xforms:bindnodeset="/credit-card/expiration-month" required="true" />

  16. Binding attributes (cont) • calculate<xforms:bindnodeset="/person/age" calculate="year-from-date (current-date()) - year-from-date(../dob)" /> • readonly<xforms:bindnodeset="/person/age" readonly="if (../dob == ‘’) then ‘false’ else ‘true’"/> • relevant<xforms:bindnodeset="/person/password" relevant="false"/>

  17. View attributes <xforms:select1ref="/moving-details/my-delivery-company"appearance="…"> <xforms:itemsetnodeset="/companies/delivery"> <xforms:labelref="label"/> <xforms:valueref="@value"/> </xforms:itemset> </xforms:select1>

  18. Disadvantages 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?

  19. Did I mention it’s all XML? • OH MY GOSH IT’S 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

  20. References • 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/

More Related