XForms 1.0

W3C Candidate Recommendation 12 November 2002

This version:
Latest version:
Previous version:
Micah Dubinko, Cardiff Software <mdubinko@Cardiff.com>
Leigh L. Klotz, Jr., Xerox Corporation <Leigh.Klotz@pahv.xerox.com>
Roland Merrick, IBM <Roland_Merrick@uk.ibm.com>
T. V. Raman, IBM <tvraman@almaden.ibm.com>

This document is also available in these non-normative formats: single HTML file, diff-marked HTML, Zip archive.


XForms is an XML application that represents the next generation of forms for the Web. By splitting traditional XHTML forms into three parts—XForms model, instance data, and user interface—it separates presentation from content, allows reuse, gives strong typing—reducing the number of round-trips to the server, as well as offering device independence and a reduced need for scripting.

XForms is not a free-standing document type, but is intended to be integrated into other markup languages, such as XHTML or SVG.

Status of this Document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. The latest status of this document series is maintained at the W3C.

This document is a Candidate Recommendation of the World Wide Web Consortium. (For background on this work, please see the HTML Activity Statement.) This specification is considered stable by the XForms Working Group and is available for public review.

Following completion of Last Call, the XForms Working Group has agreed to publish this Candidate Recommendation incorporating the resolution of all last call issues reported on the XForms 1.0 Last Call Working Draft published on 18 January 2002 and the XForms 1.0 second Last Call Working Draft published on 21 August 2002.

This Candidate Recommendation provides an opportunity for these changes to be reflected in implementations, and for the XForms Working Group to collect test cases and information about implementations. We expect that sufficient feedback to determine its future will have been received by 05 March 2003. Please send review comments before the end of the review period to www-forms-editor@w3.org. The archive for the list is accessible online.

On completion of the review, the XForms Working Group will advance the specification to Proposed Recommendation according to the following exit criteria:

It is not required that each feature be tested in each host language.

Any feedback on patterns of implementation and use of this specification would be very welcome. A list of known XForms Implementations is available. We also welcome contributions of XForms test cases.

The XForms Working Group will hold a public Implementation Workshop on Feb 27th and 28th 2003, to exchange implementation experiences, hints and techniques, and to compare XForms functionality. All implementors are welcome.

Should this specification prove impossible or very difficult to implement, the necessary changes to make it implementable will be made. If this specification is possible to implement, the only changes which will be made to this specification are minor editorial changes and clarifications.

Patent disclosures relevant to this specification may be found on the XForms Working Group's public patent disclosure page.

A list of current public W3C Working Drafts can be found at http://www.w3.org/TR.

W3C publications may be updated, replaced, or obsoleted by other documents at any time. In particular it is inappropriate to use W3C Working Drafts as reference material or to cite them as other than "work in progress".

Table of Contents

1 About the XForms 1.0 Specification
    1.1 Background
    1.2 Reading the Specification
    1.3 How the Specification is Organized
    1.4 Documentation Conventions
2 Introduction to XForms
    2.1 An Example
    2.2 Providing XML Instance Data
    2.3 Constraining Values
    2.4 Multiple Forms per Document
3 Document Structure
    3.1 The XForms Namespace
    3.2 XForms Core Attribute Collections
        3.2.1 Common Attributes
        3.2.2 Linking Attributes
        3.2.3 Single-Node Binding Attributes
        3.2.4 Node-Set Binding Attributes
        3.2.5 Model Item Property Attributes
    3.3 The XForms Core Module
        3.3.1 The model Element
        3.3.2 The instance Element
        3.3.3 The submission Element
        3.3.4 The bind Element
    3.4 The XForms MustUnderstand Module
    3.5 The XForms Extension Module
        3.5.1 The extension Element
4 Processing Model
    4.1 Events Overview
    4.2 Initialization Events
        4.2.1 The xforms-model-construct Event
        4.2.2 The xforms-model-initialize Event
        4.2.3 The xforms-initialize-done Event
        4.2.4 The xforms-ui-initialize Event
        4.2.5 The xforms-form-control-initialize Event
        4.2.6 The xforms-model-destruct Event
    4.3 Interaction Events
        4.3.1 The xforms-next and xforms-previous Events
        4.3.2 The xforms-focus Event
        4.3.3 The xforms-help and xforms-hint Events
        4.3.4 The xforms-refresh Event
        4.3.5 The xforms-revalidate Event
        4.3.6 The xforms-recalculate Event
        4.3.7 The xforms-rebuild Event
        4.3.8 The xforms-reset Event
        4.3.9 The xforms-submit Event
    4.4 Notification Events
        4.4.1 The xforms-activate Event
        4.4.2 The xforms-value-changing Event
        4.4.3 The xforms-value-changed Event
        4.4.4 The xforms-select and xforms-deselect Events
        4.4.5 The xforms-scroll-first and xforms-scroll-last Events
        4.4.6 The xforms-insert and xforms-delete Events
        4.4.7 The xforms-valid Event
        4.4.8 The xforms-invalid Event
        4.4.9 The DOMFocusIn Event
        4.4.10 The DOMFocusOut Event
        4.4.11 The xforms-readonly Event
        4.4.12 The xforms-readwrite Event
        4.4.13 The xforms-required Event
        4.4.14 The xforms-optional Event
        4.4.15 The xforms-enabled Event
        4.4.16 The xforms-disabled Event
        4.4.17 The xforms-submit-done Event
        4.4.18 The xforms-submit-error Event
    4.5 Error Indications
        4.5.1 The xforms-binding-exception Event
        4.5.2 The xforms-link-exception Event
        4.5.3 The xforms-link-error Event
        4.5.4 The xforms-compute-exception Event
5 Datatypes
    5.1 XML Schema Built-in Datatypes
    5.2 XForms Datatypes
        5.2.1 xforms:listItem
        5.2.2 xforms:listItems
        5.2.3 xforms:dayTimeDuration
        5.2.4 xforms:yearMonthDuration
6 Model Item Properties
    6.1 Model Item Property Definitions
        6.1.1 The type Property
        6.1.2 The readonly Property
        6.1.3 The required Property
        6.1.4 The relevant Property
        6.1.5 The calculate Property
        6.1.6 The constraint Property
        6.1.7 The maxOccurs Property
        6.1.8 The minOccurs Property
        6.1.9 The p3ptype Property
    6.2 Schema Constraints
        6.2.1 Atomic Datatype
7 XPath Expressions in XForms
    7.1 XPath Datatypes
    7.2 Instance Data
        7.2.1 The getInstanceDocument() Method
        7.2.2 The rebuild() Method
        7.2.3 The recalculate() Method
        7.2.4 The revalidate() Method
        7.2.5 The refresh() Method
    7.3 Evaluation Context
    7.4 Binding Expressions
        7.4.1 Model Binding Expressions
        7.4.2 UI Binding Expressions
        7.4.3 UI Binding in other XML vocabularies
        7.4.4 Binding Examples
    7.5 XForms Core Function Library
    7.6 Boolean Methods
        7.6.1 The boolean-from-string() Function
        7.6.2 The if() Function
    7.7 Number Methods
        7.7.1 The avg() Function
        7.7.2 The min() Function
        7.7.3 The max() Function
        7.7.4 The count-non-empty() Function
        7.7.5 The index() Function
    7.8 String Methods
        7.8.1 The property() Function
    7.9 Date and Time Functions
        7.9.1 The now() Function
        7.9.2 The days-from-date() Function
        7.9.3 The seconds-from-dateTime() Function
        7.9.4 The seconds() Function
        7.9.5 The months() Function
    7.10 Node-set Functions
        7.10.1 The instance() Function
    7.11 Extension Functions
8 Form Controls
    8.1 The XForms Form Controls Module
        8.1.1 Implementation Requirements Common to All Form Controls
        8.1.2 The input Element
        8.1.3 The secret Element
        8.1.4 The textarea Element
        8.1.5 The output Element
        8.1.6 The upload Element
        8.1.7 The range Element
        8.1.8 The trigger Element
        8.1.9 The submit Element
        8.1.10 The select Element
        8.1.11 The select1 Element
    8.2 Common Markup for Selection Controls
        8.2.1 The choices Element
        8.2.2 The item Element
        8.2.3 The value Element
    8.3 Additional Elements
        8.3.1 The filename Element
        8.3.2 The mediatype Element
        8.3.3 The label Element
        8.3.4 The help Element
        8.3.5 The hint Element
        8.3.6 The alert Element
9 XForms User Interface
    9.1 The XForms Group Module
        9.1.1 The group Element
    9.2 The XForms Switch Module
        9.2.1 The switch Element
        9.2.2 The case Element
        9.2.3 The toggle Element
    9.3 The XForms Repeat Module
        9.3.1 The repeat Element
        9.3.2 Creating Repeating Structures Via Attributes
        9.3.3 The itemset Element
        9.3.4 The copy Element
        9.3.5 The insert Element
        9.3.6 The delete Element
        9.3.7 The setindex Element
        9.3.8 Repeat Processing
        9.3.9 Nested Repeats
        9.3.10 User Interface Interaction
10 XForms Actions
    10.1 The XForms Action Module
        10.1.1 The action Element
        10.1.2 The dispatch Element
        10.1.3 The rebuild Element
        10.1.4 The recalculate Element
        10.1.5 The revalidate Element
        10.1.6 The refresh Element
        10.1.7 The setfocus Element
        10.1.8 The load Element
        10.1.9 The setvalue Element
        10.1.10 The send Element
        10.1.11 The reset Element
        10.1.12 The message Element
11 Submit
    11.1 The xforms-submit Event
    11.2 Submission Options
    11.3 Serialization as application/xml
    11.4 Serialization as multipart/form-data
    11.5 Serialization as application/x-www-form-urlencoded
    11.6 The post, form-data-post, and urlencoded-post Submit Methods
    11.7 The put Submit Method
    11.8 The get Submit Method
12 Conformance
    12.1 Conformance Levels
        12.1.1 XForms Full
        12.1.2 XForms Basic
    12.2 Conformance Description
        12.2.1 Conforming XForms Processors
        12.2.2 Conforming XForms Documents
        12.2.3 Conforming XForms Generators
13 Glossary Of Terms


A Schema for XForms
    A.1 Schema for XML Events
B References
    B.1 Normative References
    B.2 Informative References
C Privacy Considerations
    C.1 Using P3P with XForms
D Recalculation Sequence Algorithm
    D.1 Details on Creating the Master Dependency Directed Graph
    D.2 Details on Creating the Pertinent Dependency Subgraph
    D.3 Details on Computing Individual Vertices
    D.4 Example of Calculation Processing
E Input Modes
    E.1 inputmode Attribute Value Syntax
    E.2 User Agent Behavior
    E.3 List of Tokens
        E.3.1 Script Tokens
        E.3.2 Modifier Tokens
    E.4 Relationship to XML Schema pattern facets
    E.5 Examples
F XForms and Styling (Non-Normative)
    F.1 Pseudo-classes
    F.2 Pseudo-elements
    F.3 Examples
G Complete XForms Examples (Non-Normative)
    G.1 XForms in XHTML
    G.2 Editing Hierarchical Bookmarks Using XForms
    G.3 Survey Using XForms and SVG
H Changelog (Non-Normative)
I Acknowledgments (Non-Normative)
J Production Notes (Non-Normative)