Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Does changing the Forms configuration solve your problem?
Look at modules\_protected\EPiServer.Forms and
<episerverforms coreController="/EPiServer.Forms/DataSubmit" />
Try change that to the path of your own Controller
Are you sure you need to override the entire submit? You can always use Form Events to intercept the post form submit events and interact with the form data that way:
[InitializableModule] [ModuleDependency(typeof(EPiServer.Web.InitializationModule))] public class FormEventsInit : IInitializableModule { public void Initialize(InitializationEngine context) { FormsEvents.Instance.FormsSubmitting += Instance_FormsSubmitting; } private void Instance_FormsSubmitting(object sender, FormsEventArgs e) { // The event fires before the data is submitted so there is an opportunity to interact here var formData = e.Data; } public void Uninitialize(InitializationEngine context) { } }
Or also create your own Actor http://world.episerver.com/add-ons/episerver-forms/implementing-a-customized-actor/
All depending on what you want to do on submit.
I would say
* Take full control over submitting: Custom Controller
* Read/adjust information as it is posted: Event
* Just have a "store/send" submitted data: Actor
I have been trying to override the default form submission controller so that we can intercept certain fields, and mask the values being saved (I.e. Credit card information) only to store the last 4 or stop them from beings saved altogether. The information will also be sent to a third party to handle the processing. I have followed the Epi demo but have not had any luck. This will not hit my custom controler no matter what I Do.
Controller
[ServiceConfiguration(typeof(IDataSubmitController))] public class FormSubmissionController : DataSubmitController { public ActionResult Index() { return null; } public override ActionResult Submit() { var t = 5; return base.Submit(); } }
Initialization Module
[InitializableModule] [ModuleDependency(typeof(EPiServer.Web.InitializationModule))] public class SiteInitialization : IConfigurableModule { public void Initialize(InitializationEngine context) { GlobalFilters.Filters.Add(new HandleErrorAttribute()); context.Locate.DisplayChannelService().RegisterDisplayMode(new DefaultDisplayMode(RenderingTags.Mobile) { ContextCondition = r => r.GetOverriddenBrowser().IsMobileDevice }); } public void Uninitialize(InitializationEngine context){} public void ConfigureContainer(ServiceConfigurationContext context) { context.Container.Configure(c => { c.For().Use(new FormSubmissionController());
c.For().Use();
c.For().Use();
c.For().Use();
c.For().Use();
});
DependencyResolver.SetResolver(new StructureMapDependencyResolver(context.Container));
}
}