From Wikibooks, open books for an open world
Jump to navigation Jump to search

Introduction to XForms

XForms is a standardized set of HTML form elements, designed to be integrated with other world-wide-web standards.

XForms has many advantages over traditional HTML web forms that use complex JavaScript. These advantages include:

  1. an elegant Model-View-Controller (MVC) architecture
  2. a movement toward declarative programming which is easier to learn, maintain and debug
  3. a rich set of user interface controls for handling complex things such as dates, numbers and ranges
  4. compatibility with XML standards such as Cascading Style Sheets (CSS), XML Schema and XPath
  5. extensibility

XForms can be run today from almost any web browser by either using an downloadable plugin or extension (such as the Firefox extension) or by loading a JavaScript file. For more information see the Benefits section of this book.

About this book[edit]

This book is intended to be a tutorial and cookbook with many complete running XForms examples. The initial examples are designed to teach the fundamental concepts of XForms. The more advanced examples are designed to solve specific tasks and reduce the amount of JavaScript necessary to write high-quality forms.

We would like to have the examples ordered from simple to complex. At the end of the cookbook there are integration examples of how to extend and integrate XForms with other systems such as web services.

The philosophy behind this book centers around the fact that people often learn best by taking a fully-functioning program and making slight modifications to it to understand how it works.

Guidelines for contributors[edit]

Please feel free to add your own examples to this tutorial and cookbook! Here are a few suggestions for contributors:

Focus on Tutorial Examples[edit]

The first set of examples should focus on new XForms users. Please keep tutorials on foundational concepts (XPath and XML Schema) in a separate area so that users already familiar with these concepts can skip these sections.

Focus on Reducing JavaScript[edit]

One of the goals of this book is to help forms developers move away from hard-to-maintain scripting languages such as JavaScript. Any examples that focus on getting rid of commonly used JavaScript functions are very much appreciated.


Please tell us what XForms systems you have used to test your examples. If you can, we recommend testing using the major browsers (Internet Explorer and Firefox) using either an extension, plug-in or a JavaScript translator such as FormFaces. See also the Installing XForms in Firefox.

We would like to eventually have a small box in the upper right corner that tells what systems each example was tested under.

Avoid Duplication[edit]

Try to avoid duplication with other example programs in this cookbook and other Wikibooks on CSS, XML Schemas and XPath. That being said, sometimes the cookbook needs small samples of CSS and XPath to demonstrate how they are integrated with XForms.

Naming Conventions[edit]

Our first goal is to get as many complete working examples installed for new users of XForms. After they are working, they should hopefully be made as consistent as possible. This document describes an initial attempt at some of the naming conventions used in previous examples.

Next Page: Background

Home: XForms