DHTMLX Docs & Samples Explorer

Events Handling

List of supported 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

Attaching/Removing Event Handler

The user can add any user-defined handler to any of the available events. To do this, the user can use attachEvent() method with the following parameters:

  • evName - name of the event;
  • evHandler - user-defined event handler.
        myform.attachEvent(evName, evHandler);

Several handlers can be attached to one and the same event, and all of them will be executed. Note: the names of the events are case-sensitive.

There is a simple way of removing an event-handler:

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