XForms-specific Design Hints

The following sections describe various small tips and tricks—too small individually to be considered a design pattern—for authoring XForms content.

Always Include Keyboard Navigation Hints

Every XForms document should include enough information to provide a well-though-out navigation sequence, encompassing both form controls and other elements, such as hyperlinks, from the host language. The exact details on how to do this will vary depending on the host language, though XForms provides a sample implementation based on an attribute called navindex.

Form controls that will be frequently accessed should also include a keyboard shorcut; the details of which are again provided by the host language. The following code shows one possible way to accomplish this, in a host language that uses the techniques suggested by XForms.

<input ref="passwd" accesskey="P" navindex="3">
  <label>Password:</label>
</input>

Always Use P3P Datatypes

The least understood model item property in XForms is probably p3ptype. The W3C P3P specification defines a comprehensive set of rules about identifying what kinds of data collection take place on a web site, at a very granular level. P3P includes rules to define such datatypes, but of main interest to XForms authors are the built-in types defined as part of the base data schema.

Adding the p3ptype property during form authoring is easy, and it provides one huge benefit: autofill. Most browsers have adapted to allow the values ...

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.