8.2 Initialization Events

XForms initialization events are raised as the XForms document is being loaded by the host processor. Just as XForms markup is contained within a host language, for example, XHTML, the XForms processor can be contained within a processor for the host language. In this framework, XForms initialization events define the mechanism by which the host, an XHTML browser, interfaces with the XForms processor to initialize the XForms model and user interface.

The initialization process consists of setting up the XForms model, followed by initializing all XForms user interface controls that bind to the model. Initialization in turn consists of two phases: a construct phase where things are created in memory and an initialization phase where these newly created objects are initialized .

Following, we give a short description of these events. The details of the processing steps that occur for each of these events are not covered since that is of interest mostly to XForms implementors and are already described in the XForms specification. Notice that all initialization events are targeted at the corresponding model and that they must be handled at the model; that is, these events cannot be canceled at the model.


This event is raised for each model in the document. The event is targeted at element model and must be handled there; it cannot be canceled . The event is handled by loading all specified resources, such as schema definitions and instance declarations. If no error results, processing continues to the next stage.

Element instance is processed to construct an in-memory representation of the XML instance that holds values collected during user interaction. Model properties declared by element bind are applied to this instance.

Processing concludes by applying standard XForms processing steps of


Rebuild dependency relations


Recalculate fields that need updating


Validate the instance

When these processing steps are completed, the XForms model is initialized and ready to be populated during user interaction.


This event is raised when all models are initialized and ready for user interaction. In response to this event, processing continues by initializing the user interface that binds to the model. Initializing the user interface results in all user interface controls being bound to the instance data. This initialization consists of

  1. Wiring the control to the instance using the specified binding expression.

  2. Refreshing the presentation of the control to reflect the state of the underlying instance data. Controls are refreshed by dispatching event xforms-refresh .


This notification event is sent to each model to indicate that the user interface has been initialized.


This event is raised when an XForms processor is about to be shut down and is available for clean-up processing. It is targeted at the model and must be handled there.

Once all of these initialization steps have completed without an error condition, the XForms application is ready to process user interaction events.

XForms. XML Powered Web Forms with CD
XForms. XML Powered Web Forms with CD
Year: 2003
Pages: 94

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net