W3C

XForms 1.0 (Second Edition)

W3C Recommendation 14 March 2006

This version:
http://www.w3.org/TR/2006/REC-xforms-20060314/
Latest version:
http://www.w3.org/TR/xforms/
Previous version:
http://www.w3.org/TR/2003/REC-xforms-20031014/
Editors:
John M. Boyer, IBM
David Landwehr, Novell
Roland Merrick, IBM
T. V. Raman, Google
Micah Dubinko, Cardiff Software - (First Edition)
Leigh L. Klotz, Jr., Xerox Corporation - (First Edition)

Please refer to the errata for this document, which may include normative corrections.

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

The English version of this specification is the only normative version. Non-normative translations may also be available.


Abstract

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. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.

This document is a Recommendation of the W3C. This document has been produced by the W3C XForms Working Group as part of the XForms Activity within the W3C Interaction Domain. The authors of this document are the XForms Working Group participants.

This document has been reviewed by W3C Members, by software developers, and by other W3C groups and interested parties, and is endorsed by the Director as a W3C Recommendation. It is a stable document and may be used as reference material or cited from another document. W3C's role in making the Recommendation is to draw attention to the specification and to promote its widespread deployment. This enhances the functionality and interoperability of the Web.

Comments on this document are welcome. Please send them to the public mailing list www-forms-editor@w3.org. (archive). It is inappropriate to send discussion email to this address.

The W3C XForms Working Group has released a public test suite for XForms 1.0. A list of current known XForms Implementations is also available.

This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. The Working Group maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

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-construct-done Event
4.2.3 The xforms-ready Event
4.2.4 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 DOMActivate Event
4.4.2 The xforms-value-changed Event
4.4.3 The xforms-select and xforms-deselect Events
4.4.4 The xforms-scroll-first and xforms-scroll-last Events
4.4.5 The xforms-insert and xforms-delete Events
4.4.6 The xforms-valid Event
4.4.7 The xforms-invalid Event
4.4.8 The DOMFocusIn Event
4.4.9 The DOMFocusOut Event
4.4.10 The xforms-readonly Event
4.4.11 The xforms-readwrite Event
4.4.12 The xforms-required Event
4.4.13 The xforms-optional Event
4.4.14 The xforms-enabled Event
4.4.15 The xforms-disabled Event
4.4.16 The xforms-in-range Event
4.4.17 The xforms-out-of-range Event
4.4.18 The xforms-submit-done Event
4.4.19 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
4.6 Event Sequencing
4.6.1 For input, secret, textarea, range, or upload Controls
4.6.2 For output Controls
4.6.3 For select or select1 Controls
4.6.4 For trigger Controls
4.6.5 For submit Controls
4.6.6 Sequence: Selection Without Value Change
4.6.7 Sequence: Value Change
4.6.8 Sequence: Activating a Trigger
4.6.9 Sequence: Submission
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 p3ptype Property
6.2 Schema Constraints
6.2.1 Atomic Datatype
7 XPath Expressions in XForms
7.1 XPath Datatypes
7.2 Feature string for the hasFeature method call
7.3 Instance Data
7.3.1 The getInstanceDocument() Method
7.3.2 The rebuild() Method
7.3.3 The recalculate() Method
7.3.4 The revalidate() Method
7.3.5 The refresh() Method
7.4 Evaluation Context
7.5 Binding Expressions
7.5.1 Dynamic Dependencies
7.5.2 Model Binding Expressions
7.5.3 UI Binding Expressions
7.5.4 UI Binding in other XML vocabularies
7.5.5 Binding Examples
7.6 XForms Core Function Library
7.7 Boolean Functions
7.7.1 The boolean-from-string() Function
7.7.2 The if() Function
7.8 Number Functions
7.8.1 The avg() Function
7.8.2 The min() Function
7.8.3 The max() Function
7.8.4 The count-non-empty() Function
7.8.5 The index() Function
7.9 String Functions
7.9.1 The property() Function
7.10 Date and Time Functions
7.10.1 The now() Function
7.10.2 The days-from-date() Function
7.10.3 The seconds-from-dateTime() Function
7.10.4 The seconds() Function
7.10.5 The months() Function
7.11 Node-set Functions
7.11.1 The instance() Function
7.12 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
10.1.13 Actions insert, delete and setindex
11 Submit
11.1 The xforms-submit Event
11.2 Submission Options
11.3 Serialization as application/xml
11.4 Serialization as multipart/related
11.5 Serialization as multipart/form-data
11.6 Serialization as application/x-www-form-urlencoded
11.7 The post, multipart-post, form-data-post, and urlencoded-post Submit Methods
11.8 The put Submit Method
11.9 The get Submit Method
12 Conformance
12.1 Conformance Levels
12.1.1 XForms Full
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

Appendices

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)