Skip to Content
XForms Essentials
book

XForms Essentials

by Micah Dubinko
August 2003
Beginner to intermediate
240 pages
7h 44m
English
O'Reilly Media, Inc.
Content preview from XForms Essentials

Making the Connection—Binding

The remaining detail is how to associate model item properties with particular instance data nodes. The answer is binding, but it’s worth being extra clear with terminology: a bind has two ends, one side in the XForms Model, and the other side at a form control. On the bind element within the XForms Model, the nodeset attribute holds the Model Binding Expression. On the other end, in the user interface, is the UI Binding Expression. This end may be bound two ways, using either IDREFs or XPath.

With IDREFs

The recommended way to perform binding is to put an id attribute on each bind element, and refer back to this with a bind attribute on each form control:

<!-- in the XForms Model -->
<xforms:bind nodeset="email" id="mybind" required="true()"/>
...
<!-- later in the document -->
<xforms:input bind="mybind"...>

This approach is distinguished by the use of the bind attribute on form controls. The main advantage of this approach is that it maintains separation between the model and the view. If the structure of the instance data were to change, only the attributes on the bind elements would need to be updated. In large organizations, form authoring often involves separate teams: a graphic design team to lay out the form, and a systems team to handle the data integration. In such scenarios, IDREF binding provides a perfect interface between content and presentation.

With XPath

Another way to bind is with XPath expressions on the form controls:

<!-- in ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

XForms: XML Powered Web Forms

XForms: XML Powered Web Forms

T.V. Raman
Using XForms with Mozilla

Using XForms with Mozilla

J. David Eisenberg
What Successful Project Managers Do

What Successful Project Managers Do

W. Scott Cameron, Jeffrey S. Russell, Edward J. Hoffman, Alexander Laufer
XPath and XPointer

XPath and XPointer

John Simpson

Publisher Resources

ISBN: 0596003692Catalog PageErrata