DHTMLX Docs & Samples Explorer

Index
dhtmlxForm

# Events

DhtmlxForm allows to handle different kinds of events in an application.

You can attach several handlers to the same event, and all of them will be executed.

Event names are case-insensitive.

## Adding event

If you need to attach event to an application, use attachEvent() method.

    myform.attachEvent(evName, evHandler);

- evName - the name of an event;
- evHandler - a user-defined event handler.

## Deleting Event

You can also delete event if you need. The detachEvent() method helps you here.

    var id = myform.attachEvent("onDirty",some_code);
       ...
    myform.detachEvent(id);

## The list of events

The following events are available in dhtmlxForm:

- Loading related:
  - onXLS - occurs before the request for a new XML was sent to the server;
  - onXLE - occurs simultaneously with ending XML of parsing, new data is already processed by the form.

- Events of constructed form:
  - onChange - occurs when data in some input was changed;
  - onBeforeChange - occurs before data in some input changed ( by user actions );
  - onButtonClick - occurs when user clicks button;

- Binding related events:
  - onBeforeDataLoad - occurs when data from server is loaded but before it set in form
  - onBeforeSave - occurs before sending data to the server
  - onAfterSave - occurs after saving data in DB
  - onBeforeRemove - occurs when signal to delete current record is received
  - onAfterRemove - occurs when record was deleted from server
  - onBeforeReset - occurs before resetting the form
  - onAfterReset - occurs after resetting the form
  - onDirty - occurs before form reloading with different data, when data in existing form was changed but not saved

- Validation related events:
  - onBeforeValidate - occurs before validation
  - onValidateError - occurs for each error during validation
  - onValidateSuccess - occurs for each success during validation
  - onAfterValidate - occurs after validation