O'Reilly logo

XForms Essentials by Micah Dubinko

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. The XForms User Interface

“A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, and die gallantly. Specialization is for insects.”

Robert A. Heinlein

Form controls are windows onto the form data kept in the XForms Model. In principle, this was true also for HTML forms, although the design of XForms makes a much sharper separation.

Form Controls

The following sections describe every form control included in XForms. The examples show a variety of different binding techniques through the attributes ref, model, and bind, which are explained in Chapter 5.

input

This form control is quite similar to its HTML forms counterpart, as it permits the entry of any character data. There are some significant improvements, however, such as the ability to use an XML Schema datatype to optimize the user experience of entering the data. Example 6-1 shows sample code for an entry control, and Figure 6-1 shows several different renderings, selected by datatype, of an input control in the open source X-Smiles browser, available at http://www.x-smiles.org.

Example 6-1. Sample markup for an input control

<input ref="string"> <!-- bound to node with XML Schema type xs:string --> <label>xsd:string</label> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required