Chapter 8. Submit

“This element encodes how, where, and what to submit.”

XForms Candidate Recommendation, 12 November 2002, section 3.3.3, “The submission Element”

Data collection is a multibillion-dollar industry, so it’s not surprising that XForms includes a rich set of options for submitting form data. Getting data out of old HTML forms is an exercise in jumping through hoops, due largely to the limited data format defined for forms—name/value pairs generally. XForms can still provide data in these legacy formats, though it shines the brightest when sending XML data.

The four main questions in submitting form data are when, what, where, and how. The following sections discuss each of these questions.

When to Submit

Submit happens when the user presses the big button labeled “Submit,” right? Well, sure, but there’s more to the story than that.

Formally, a submission is initiated when an event called xforms-submit arrives at the submission element (described in detail later in this chapter) For more on XML events, see Chapter 7. The reason for a separate event is so that submission can be requested in other situations, such as pressing Enter or meeting other conditions. The XForms Action send can explicitly send out the submission event, and the form control named submit, which otherwise behaves exactly like trigger, also dispatches an xforms-submit event, thus providing the click-to-submit feature...except that dispatching the xforms-submit event doesn’t guarantee that the submission ...

Get XForms Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.