Optimizely Forms is only supported by MVC-based websites and HTML5-compliant browsers.
After a visitor submits a form, Forms.Core calls Actors to perform additional processing on the server.
- You can extend and plug in the Actor, and a third-party developer can implement it.
- You can run Actors in a sync or async manner.
- Each actor is provided with several data, including
- Sync-actor can have (and can modify) the
HttpResponse, so Actor can modify response and cookie before sending back result to a visitor's browser.
By default, Optimizely Forms has two built-in Actors:
From version 4.16.0, it is possible to allow actors to:
- Return a signal to cancel a form submission in the case where an actor fails.
- Return an error message to be displayed to visitors.
To be able to cancel form submissions and to display error messages, you need to implement the following changes:
- Actors must implement
ISyncOrderedSubmissionActor. Actors implementing this interface run synchronously in ascending order, regardless of the
IsSyncedWithSubmissionProcessvalue. (Actors are forced to run synchronously because we cannot control the result of async actors).
- Actors must return an object instance of a class which implements
By implementing this interface, the returned result will have two properties:
CancelSubmit(boolean): determines whether the form submission should be canceled or not.
ErrorMessage(string): this error message will be displayed to visitors.
Basically, third-party developer can implement his own Actor by:
- Inheriting a
- Starting from scratch with the
IPostSubmissionActorinterface and interface
IUIPropertyCustomCollectionfor edit view user interface of configuring the Actor model.
See sample code about implementing a new Actor in the open-source project on GitHub.
Updated about 1 month ago