Skip to content

Responding to Form Events

Randall Knutson edited this page Mar 15, 2018 · 3 revisions

The formio module emits events at various times. These events are designed to allow developers to respond to events that occur within the formio generated forms. For example, after a user creates a new submission, you may want to change the view to display that submission or send them to a thank you page. You can do this by responding to the formSubmission event:

$scope.$on('formSubmission', function(err, submission) { /* ... */ })

The following are all the events emitted by the above directives:

formSubmit
Called after a form is submitted, but before it has been sent to the server. This submission can be cancelled by calling `event.preventDefault()`.
Parameters:
submission: The submission that was submitted.
formSubmission
Called after a form is successfully submitted to the server. This can be either a create or an edit.
Parameters:
submission: The submission that was submitted.
formError
Called whenever client side validation fails.
Parameters:
error: The error that occurred.
formLoad
Called whenever a form is loaded from the form.io server. This is useful to customize forms before they are displayed.
Parameters:
form: The form that was loaded.
submissionView
Called whenever the view button is clicked in a `formioSubmissions` directive.
Parameters:
submission: The submission that is being viewed.
submissionEdit
Called whenever the edit button is clicked in a `formioSubmissions` directive.
Parameters:
submission: The submission that is being edited.
submissionDelete
Called whenever the delete button is clicked in a `formioSubmissions` directive.
Parameters:
submission: The submission that is being deleted.
submissionLoad
Called whenever a submission is loaded from the server.
Parameters:
submission: The submission that was loaded.
submissionsLoad
Called whenever multiple submissions are loaded from the server.
Parameters:
submissions: An array of submissions that were loaded.
cancel
Called whenever a delete dialog is cancelled.
delete
Called whenever a delete dialog is confirmed and a submission is deleted.
Parameters:
data: The data that was returned from the delete request.