November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Sounds like something I would be missing. I have not found any sort of documentation of what and where needs changed besides adding that file.
Any idea what I need to do exactly?
Tried the attribute?
[ServiceConfiguration(typeof(IDataSubmitController))]
and then add a line in
https://github.com/episerver/EPiServer.Forms.Demo/blob/master/DemoInitializationModule.cs
to map the IDataSubmitController to your implementation.
(Was already using this)
[ServiceConfiguration(typeof(IDataSubmitController))] public class DemoSubmitFormController : DataSubmitController { public ActionResult Index() { return View(); } }
I copied the class from your example and modified Initialize to the following:
public void Initialize(InitializationEngine context) { _serviceConfigurationContext.Container.Configure(c => { c.For<IDataSubmitController>().Use(new DemoSubmitFormController()); }); }
It still throws the same exception.
Hi,
Sorry for the missing information. In the beginning, we intended to use IDataSubmitController and StructureMap for resolving the CoreController for Forms to work. But later on, we decide to use normal ASP.NET MVC controller because it would be easier. (We might change, so the DI solution like yours would work). So last time I check (with AlloyMVC as a test website) this is true for Forms 2.0:
You can use your own controller.
<episerverforms ... coreController="/EPiServer.Forms/DataSubmit" ... </episerverforms>
You can reconfigure the coreController to point to any ASP.NET MVC controller.
I will update the Demo project and write an article for this. Thank you.
Lockevn.
Hi @Lockevn - I've successfully routed and configured forms to use a custom controller which inherits DataSubmitController. I want to just use the base GetFormInitScript and only override the Submit action. When the base GetFormInitScript action is called I'm getting an error (Unable to find a module by assembly '[my assembly detail]' Parameter name: moduleAssembly). Is there some additional config to allow this to work? Thanks.
Neil
Hi Neil,
The GetFormInitScript() utilizes Paths.ToResource(GetType(), "Views/FormContainerInitScript.ascx") to take the ascx template, then render the JavaScript from that template.
By default, the template is in wwwroot\modules\_protected\EPiServer.Forms\Views/FormContainerInitScript.ascx
Because your custom controller is not in a correct "Episerver module", the Paths.ToResource() fails.
Let's say, you write your custom Controller in AlloyMVC (which is an correct "Episerver module"), DataSubmitController.GetFormInitScript() will take the view from wwwroot/Views/FormContainerInitScript.ascx
There is no more configuration.
We will change DataSubmitController.GetFormInitScript() to take view from exactly in EPiServer.Forms module (use typeof(DataSubmitController) instead of using just GetType()) . But at the moment, you have to override it totally. Sorry for this.
We will change DataSubmitController.GetFormInitScript() to take view from exactly in EPiServer.Forms module (use typeof(DataSubmitController) instead of using just GetType()) . But at the moment, you have to override it totally. Sorry for this.
AFORM-665 is fixed and closed in Forms 3.0
Tried implementing the example for having the custom form submit controller however doing so I get an error stating it cannot find a default controller for form submissions. How do I override and set which controller to use?
Error Message:
Additional information: No default Instance is registered and cannot be automatically determined for type 'EPiServer.Forms.Controllers.IDataSubmitController'
Thanks!