pp108 : xforms-oninitialize

xforms-oninitialize

This event is fired after a load on demand control is selected. You can use this event to perform operations such as setting default values, retrieving data from the Web services and binding it to the child controls. The load on demand property is available in the property sheet of the TabPage and Groupbox.

Syntax

The load on demand elements raise the event xforms-oninitialize when they load. The logic for any initialization must go into the corresponding event handler. This event can be attached to a control as follows:

<control ID>.addListener("xforms-oninitialize", handleTabInitialize);

Note: This event fires only once when the control is selected for the first time.

Event Information

To invoke

The TabPage is invoked when the tab is focused, and the Groupbox is invoked when it is expanded.

Default Action

Initiates any action associated with the event

Named Script

xforms-onintialize

Event Object Properties

Property

Description

srcElement

Reference to the control

An event handler can access the event object and its properties through the eventObject available as a parameter on the handler.

Remarks

If you have logic in the first TabPage or have load on demand element that modifies or affects any control in other load on demand element, the code must be moved to the initialize event of the corresponding element.

Occasionally, when the user saves a form, the application collects data from the elements.

  • If the element is inside a load on demand element, then invoking any API, for example, getValue(), results in a script error as the element is not initialized. Hence, it is always recommended to collect the required data from the model.
  • If the element is a free form element, it must be checked if the load on demand element is initialized and then collect the data from its children.
    The following code depicts the usage of this API:
    tabpage.isInitialized();
    

Applies to

Groupbox, TabPage