formData.on

Registers handlers for the default app logic events of a form driven flow. These events include predefined moments in the flow execution sequence, such as before the form's user interface is initially rendered, after a step's data is saved to the database, or advancing to the next step of a form. For more information about the default client-side app logic events, see the code execution sequence documentation.

The method's first argument determines the event the handler is attached to:

You can define multiple handlers for the same event by storing the formData.on definitions in variables. This way, when an event is triggered, all its handlers' callback functions are executed.

Copy
formScope.firstHandler = formData.on('formBeforeGenerate', firstFunction);
formScope.secondHandler = formData.on('formBeforeGenerate', secondFunction);
formScope.thirdHandler = formData.on('formBeforeGenerate', thirdFunction);

The formData.on methods return an IDisposable object that enables you to remove such event handlers using the dispose() method:

Copy
formScope.firstHandler.dispose();
formScope.secondHandler.dispose();
formScope.thirdHandler.dispose();

Examples