Skip to main content

Event handling

Attaching event listeners​

You can add a custom handler to any Form event with the form.events.on() method. The method takes the following parameters:

evNamethe event name
evHandlera custom event handler
form.events.on("click", function(name,e){
console.log(name);
});

You can attach several handlers to the same event, and Form runs all of them.

Related sample: Form. Events

note

Event names are case-insensitive.

Detaching event listeners​

The form.events.detach() method removes an event handler:

form.events.on("click", function(name,e){
console.log(name);
});

form.events.detach("click");

Calling events​

The fire() method of the events module calls a custom event:

form.events.fire(evName,[args]);

List of supported events​

You can find the full list of Form events in the API section.