This information is in part taken from the O'Reilly book XForms Essentials. Used with permission.

Data flows ever on and on

XForms makes it easy to arrange workflows, where data travels not just from a client to a destination server, but along various intermediate routes. This kind of processing is exceedingly commonplace in paper forms, which tend to require multiple levels of approval by different individuals.

What's more, XForms supports more than just XML data--it can also submit name/value pairs in both of the formats common to existing servers, as well as a special format designed for efficient encoding of XML containing lots of binary characters, as is typically generated by a output form control.

Submission is controlled through two main attributes on the submission element, method which takes certain predefined strings like "get", and action which takes a URL. The scheme of the url, such as http: influcences how the submission will occur.

Choosing the right submission options

This handy chart will help you configure the appropriate attributes on the submission element. Note that a few special-purpose attributes, such as includenamespaceprefixes and separator are used here, even though not specifically covered in this tutorial.

When you have this scenario...

...use a submission element such as this

Your solution produces a small amount of data, which contains no sensitive information and doesn't trigger any significant obligations.

<submission method="get" action="http URI"/>

Your solution has to work with a server configured to accept GET requests from HTML forms.

<submission method="get" separator="&amp;" action="http or https URI"/>

Your solution creates new XML data.

<submission method="put" inlcudenamespaceprefixes="" action="http, https, ftp, or file URI"/>

Your solution feeds XML data into a larger processing system.

<submission method="post" includenamespaceprefixes="" action="http, https, or mailto URI"/>

Your solution has to work with a server configured to accept standard POST requests from HTML forms.

<submission method="urlencoded-post" action="http or https URI"/>

Your solution has to work with a server configured to accept file uploads from HTML forms.

<submission method="form-data-post" action="http or https URI"/>

Your solution produces XML data that includes lots of embedded binary data.

<submission method="form-data-post" action="http, https, or mailto URI"/>

Your solution includes upload controls that accept anyURI data.

<submission method="multipart-post" action="http, https, or mailto URI"/>

Review

Since you have completed the last lesson, you can reward yourself by having no exercises, just an overall review.

  1. XForms is a new W3C Recommendation for forms on the Web.
  2. For very simple forms, XForms provides a very simple syntax, often called "lazy authoring".
  3. XForms separates the XForms Model, the specification of data collection, from the user interface.
  4. The key to the power of XForms is that it can work with any XML. This feat is accomplished through binding, the connection between XForms Model and User Interface.
  5. Form controls are specified by intent, not specific embodiment. You can, however, provide a hint to how things should look, or provide very specific instructions through style sheets.
  6. XForms offers a variety of submission options, ranging from backwards-compatible name/value pairs to full XML.

Continue on for a wrap-up of this tutorial as well as information on where to go for more in-depth XForms training.