Forms events

The Forms module exposes events that are related to the data passed by the form during the submission process. To subscribe to events, we recommend using the interfaces, even if the events that fire are concrete implementations (classes).

Following is a full list of the events supported by Forms:

IFormsModuleEvent

This interface is implemented by all events fired for Forms. Use it, if you want to subscribe to all of them. Subscribe using the following code:

IFormEntryEvent

The IFormEntryEvent interface inherits from IFormsModuleEvent, and is the base interface, responsible for form entries events, that fire on specific actions such as create or update.

In the event handler, you can access the following information:

  • The ID of the submitted form entry.
  • The ID of the user submitting the form.
  • The username of the user submitting the form.
  • The IP address of the client that submits the form entry.
  • The date/time of the form entry submission.
  • The ID of the form being submitted.
  • The unique (code) name of the form being submitted.
  • The title of the form being submitted.
  • The ID of the list of submission notification subscribers for this form.
  • A collection of the form controls. You can work with this collection to retrieve their title, values, and so on.

To subscribe, use the following:

IFormEntryCreatedEvent

This interface is implemented by all events that fire after a form entry is created. There is only one such built-in event and you must subscribe to the interface rather than the class that implements it. Since this interface inherits from IFormEntryEvent, you can access the same type of information inside your event handler. Subscribe using the following code:

IFormEntryUpdatedEvent

This interface is implemented by all events that fire after a form entry is updated. There is only one such built-in event and you must subscribe to the interface rather than the class that implements it. Since this interface inherits from IFormEntryEvent, you can access the same type of information inside your event handler. Subscribe using the following code:

IFormEvent

This interface is a contract for events that contain all form data. The interface inherits the IFormModuleEvent. The IFormEvent is implemented by the following events:

  • BeforeFormActionEvent - the event is raised before the form action gets executed, for example, redirecting to another page or showing a success message.
  • FormSavingEvent - the event is raised before a form is saved.
  • FormSavedEvent - the event is raised after a form is saved.

NOTE: If an action is cancelled, the event handlers throw an exception: Telerik.Sitefinity.Services.Events.CancelationException.

Anytime an action related to forms is executed, the IFormEvent is raised. To subscribe to the event, use the following code:

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Web Security for Sitefinity Administrators

The free standalone Web Security lesson teaches administrators how to protect your websites and Sitefinity instance from external threats. Learn to configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?