You are previewing XForms Essentials.
O'Reilly logo
XForms Essentials

Book Description

The use of forms on the web is so commonplace that most user interactions involve some type of form. XForms--a combination of XML and forms--offers a powerful alternative to HTML-based forms. By providing excellent XML integration, including XML Schema, XForms allows developers to create flexible, web-based user-input forms for a wide variety of platforms, including desktop computers, handhelds, information appliances, and more. XForms Essentials is an introduction and practical guide to the new XForms specification. Written by Micah Dubinko, a member of the W3C XForms working group and an editor of the specification, the book explains the how and why of XForms, showing readers how to take advantage of them without having to write their own code. You'll learn how to integrate XForms with both HTML and XML vocabularies, and how XForms can simplify the connection between client-based user input and server-based processing. XForms Essentials begins with a general introduction to web forms, including information on history and basic construction of forms. The second part of the book serves as a reference manual to the XForms specification. The third section offers additional hints, guidelines, and techniques for working with XForms. Topics covered in the book include:

  • creating XForms files in a text or XML editor

  • converting existing forms (electronic or paper) to XForms

  • collecting XML data from users in a user-friendly way

  • reducing the amount of JavaScript needed within browser interfaces

  • increasing the security and reliability of your current forms system by combining client-side and server-side checks into a common code base

  • creating interactive websites using the latest standard technology

XForms Essentials focuses on the practical application of XForms technology. If you work with forms, HTML, or XML information, XForms Essentials will provide you with a much simpler route to more sophisticated interactions with users.

Table of Contents

  1. XForms Essentials
    1. Preface
      1. Who Should Read This Book?
      2. Who Should Not Read This Book?
      3. If You’re Still Reading This...
      4. About the Examples
      5. Organization of This Book
      6. Conventions Used in This Book
      7. How to Contact Us
      8. Acknowledgments
    2. 1. Introduction to Web Forms
      1. The Past, Present, and Future of Web Forms
      2. A Brief Review of HTML Forms
        1. Single-Line Text Input
        2. Multi-Line Text Input
        3. Password Text Input
        4. Submit and Reset
        5. Buttons
        6. Radio Buttons
        7. Checkboxes
        8. Single-Select Menus
        9. Multiple-Select Menus
        10. File Select
        11. Hidden Controls
        12. Object Controls
        13. Labels and Legends
        14. Access and Navigation
        15. Readonly and Disabled
        16. Initialization
        17. Submit
      3. Limitations of HTML Forms, Advantages of XForms
      4. The History of XForms
      5. The Revenge of the Simple Syntax
    3. 2. XForms Building Blocks
      1. More Than Forms
      2. A Real-World Example
      3. Host Language Issues
        1. Combined Document Types
      4. Linking Attributes
    4. 3. XPath in XForms
      1. Getting Up to Speed with XPath
      2. Going Deep: The XPath Data Model
      3. Location Paths
        1. Context
        2. Axes
          1. Abbreviated axes
        3. Predicates
      4. Computed Expressions
        1. Operators
          1. Arithmetic basics (+, -, *, div, and mod)
          2. Equality comparisons (=and !=)
          3. Relational comparisons (<, >, <=, and =>)
          4. Boolean operations (or, and)
          5. Node-set unions (|)
        2. Functions
            1. position( )
            2. last( )
            3. count( )
            4. id( )
            5. local-name( )
            6. namespace-uri( )
            7. name( )
            8. string( )
            9. concat( )
            10. starts-with( )
            11. contains( )
            12. substring-before( )
            13. substring-after( )
            14. substring( )
            15. string-length( )
            16. normalize-space( )
            17. translate( )
            18. boolean( )
            19. not( )
            20. true( )
            21. false( )
            22. lang( )
            23. number( )
            24. sum( )
            25. floor( )
            26. ceiling( )
            27. round( )
            28. boolean-from-string( )
            29. if( )
            30. avg( )
            31. min( )
            32. max( )
            33. count-non-empty( )
            34. index( )
            35. property( )
            36. now( )
            37. instance( )
            38. days-from-date( )
            39. seconds-from-dateTime( )
            40. seconds( )
            41. months( )
          1. Extension Functions
      5. How XPath is Used in XForms
        1. Context Nodes
        2. Model Binding Expressions
        3. UI Binding Expressions
        4. Computations
    5. 4. XML Schema in XForms
      1. Wide Open (Value) Spaces
        1. Derivation
          1. Regular expressions
      2. Useful Datatypes
        1. xs:string
        2. xs:normalizedString
        3. xs:language
        4. xs:boolean
        5. xs:decimal
        6. xs:integer
        7. xs:nonPositiveInteger
        8. xs:negativeInteger
        9. xs:nonNegativeInteger
        10. xs:positiveInteger
        11. xs:double
        12. xs:dateTime
        13. xs:time
        14. xs:date
        15. xs:base64Binary
        16. xs:anyURI
        17. xforms:yearMonthDuration
        18. xforms:dayTimeDuration
        19. xforms:listItem
        20. xforms:listItems
      3. Other Datatypes
        1. xs:float
        2. xs:duration
        3. “gHorribleKluge”
        4. xs:hexBinary
        5. Computer-centric numbers
        6. Markup datatypes
      4. An Email Datatype for XForms
        1. Using the Email Datatype
      5. Complex Types
      6. xsi:type
    6. 5. The XForms Model
      1. Will the Real Data Model Step Forward?
      2. Structural Elements
        1. The model Element
        2. The instance Element
        3. The bind Element
        4. The submission Element
      3. Common Attributes
        1. Binding Attributes—Single Node and Node-set
      4. Model Item Properties
        1. type
        2. readonly
        3. required
        4. relevant
        5. calculate
        6. constraint
        7. p3ptype
      5. Making the Connection—Binding
        1. With IDREFs
        2. With XPath
        3. Multiple Models
        4. Multiple Instances
    7. 6. The XForms User Interface
      1. Form Controls
        1. input
        2. secret
        3. textarea
        4. output
        5. upload
        6. range
        7. trigger
        8. submit
        9. select1
        10. select
        11. Complex Lists
        12. Common Markup
          1. Labels
          2. help, hint, and alert
          3. Navigation order
          4. Keyboard shortcuts
          5. Coarse-grained appearance
          6. Input mode
          7. Event handlers
      2. Interaction with Instance Data
        1. Incremental
      3. Grouping
      4. Dynamic Presentation
        1. switch and case
      5. Repeating Line Items
        1. repeat
        2. Attribute Syntax
    8. 7. Actions and Events
      1. XML Events
        1. The Old Way
        2. Listeners, Observers, and Handlers
        3. Declarative Actions, Displacing Script
      2. XForms Actions
        1. message
        2. setvalue
        3. setfocus
        4. send
        5. reset
        6. load
        7. toggle
        8. insert
        9. delete
        10. setindex
        11. revalidate, recalculate, refresh, and rebuild
        12. dispatch
        13. action
      3. XForms Events
        1. Stages of XForms Processing
        2. Useful Events
          1. The DOMActivate Event
          2. The DOMFocusIn and DOMFocusOut Events
          3. The xforms-ready Event
          4. The xforms-model-construct-done Event
          5. The xforms-model-destruct Event
          6. The xforms-help and xforms-hint Events
          7. The xforms-reset Event
          8. The xforms-submit Event
          9. The xforms-value-changed Event
          10. The xforms-select and xforms-deselect Events
          11. The xforms-valid and xforms-invalid Events
          12. The xforms-readonly and xforms-readwrite Events
          13. The xforms-required and xforms-optional Events
          14. The xforms-enabled and xforms-disabled Events
          15. The xforms-out-of-range and xforms-in-range Events
          16. The xforms-submit-done Event
        3. Less-Useful Events
          1. The xforms-rebuild, xforms-recalculate, xforms-revalidate, and xforms-refresh Events
          2. DOM Mouse Events
          3. DOM Keyboard Events
          4. DOM Mutation Events
          5. The xforms-model-construct Event
          6. The xforms-focus Event
          7. The xforms-insert and xforms-delete Events
          8. The xforms-next and xforms-previous Events
          9. The xforms-scroll-first and xforms-scroll-last Events
        4. Error Handling
          1. The xforms-submit-error Event
          2. The xforms-binding-exception Event
          3. The xforms-link-exception Event
          4. The xforms-link-error Event
          5. The xforms-compute-exception Event
    9. 8. Submit
      1. When to Submit
      2. What to Submit
      3. Where and How to Submit
        1. URI Scheme and Method
          1. http or https
          2. file
          3. mailto
          4. Others...
        2. Serialization Formats for Data Submission
          1. application/xml
          2. application/x-www-form-urlencoded
          3. multipart/related
          4. multipart/form-data
      4. What Happens After Submit?
      5. The submission Element
        1. submission
      6. Review: Submission Options
      7. Security and Privacy Concerns
    10. 9. Styling XForms
      1. CSS, Level 3
        1. The Appearance Property
        2. Aligning Form Controls and Labels
        3. Styling Invalid Form Controls
        4. Styling Required Form Controls
        5. Styling Alert Messages
        6. Styling Repeating Items
        7. Styling Non-Visible Items
    11. 10. Form Accessibility, Design, and Troubleshooting
      1. Basics of Accessibility
        1. W3C Accessibility Guidelines
      2. Form Design Patterns
        1. Stepwise XPath
        2. Design by Buddy System
        3. XML Localization
      3. XForms-specific Design Hints
        1. Always Include Keyboard Navigation Hints
        2. Always Use P3P Datatypes
        3. Don’t Use a Form for Navigation
        4. Concatenating a Currency Symbol or Special Character
        5. Server-Side Database Lookups
        6. Reliably Submitting the Form with Enter
        7. Refresh-on-Demand
      4. Troubleshooting
        1. Stubborn Read-only Controls
        2. Context Node Problems
        3. XForms Portion of Document Not Recognized
        4. Schema or Validation Errors
      5. Making the Switch to XForms
        1. Client-Side and Server-Side XForms
        2. The Featherweight Client
        3. The Scriptable Client
        4. The Modern Browser Client
        5. Client-Side Options
    12. 11. Extending XForms
      1. The Cost of Extensibility
        1. Extension and mustUnderstand
      2. Ways to Extend
        1. With Script
          1. The getInstanceDocument( ) method
          2. The rebuild( ), recalculate( ), revalidate( ), and refresh( ) methods
        2. With New Datatypes and Libraries
        3. With XPath Extension Functions
        4. With New Form Controls
        5. With XForms Actions
        6. With Custom Events
        7. With New Serialization Formats
    13. A. Examining Microsoft InfoPath
      1. How Does It Work?
      2. Similar, Different
      3. A Real-World Example
      4. Conclusion
    14. B. The GNU Free Documentation License
      1. GNU Free Documentation License
      2. 0. Preamble
      3. 1. APPLICABILITY AND DEFINITIONS
      4. 2. VERBATIM COPYING
      5. 3. COPYING IN QUANTITY
      6. 4. MODIFICATIONS
      7. 5. COMBINING DOCUMENTS
      8. 6. COLLECTIONS OF DOCUMENTS
      9. 7. AGGREGATION WITH INDEPENDENT WORKS
      10. 8. TRANSLATION
      11. 9. TERMINATION
      12. 10. FUTURE REVISIONS OF THIS LICENSE
      13. Addendum: How to use this License for your documents
    15. Index
    16. Colophon