AJAX forms events

PREREQUISITES: You have enabled the AJAX submit call functionality for the Forms module. For more information, see Submit forms using AJAX call.

IFormValidatingEvent

The following interface is implemented by all events raised before a form is validated. There is only one such built-in event FormValidatingEvent and you must subscribe to the interface rather than the class that implements it. Subscribe to the event using the following code:

The above example demonstrates how to check for invalid input.
As a result, if you attempt to submit the form with a value that does not match the validation criteria, an error message The 'Name' field must consist of two words. is displayed.

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

  • The ID of the user submitting the form.
  • The user name of the user submitting the form.
  • The IP address of the client that submits the form entry.
  • The ID of the form being submitted.
  • The unique (code) name of the form being submitted.
  • The title of the form being submitted.
  • The origin of the event.
  • A collection of the form controls that you can use to retrieve the forms' title, values, and so forth.

IFormFieldValidatingEvent

This interface is implemented by the FormFieldValidatingEvent and is raised when a form field is validated. Subscribe to the event using the following code:

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

  • The origin of the event.
  • The field that is being validated.

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

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. 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?