“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.”
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.
The following sections describe every form control included in
XForms. The examples show a variety of different binding techniques
through the attributes
bind, which are
explained in Chapter 5.
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> ...