Optimizely CMS provides customization of content using events. A standard collection of events exists for most content types. However, additional events are available to further customize Optimizely Forms. To subscribe to Form events you use an Initialization module to attach an event handler. The logic for the event is typically defined in the same class. For handling a single form or event this might be enough. Sometimes, though, you need more event handlers for different form types. While the event method can handle this, using an Interface pattern can be cleaner.
Choosing a Global Software Development Partner to Accelerate Your Digital Strategy
To be successful and outpace the competition, you need a software development partner that excels in exactly the type of digital projects you are now faced with accelerating, and in the most cost effective and optimized way possible.
Get the Guide
An Interface pattern allows you to define the event handlers based on an Interface. A custom Interface is defined for each event, and any class that needs to handle an event inherits from the appropriate Interface. This approach allows you to define the event methods on the objects requiring them, instead of in the Initialization module. It results in cleaner code, and makes it easier to identify which objects handle events.
To learn more about implementing this approach, read my article, Optimizely Form Events using an Interface Pattern, and leave a comment below to share additional helpful information.