Getting EPiServer Forms working, javascript and formsubmissions
Forms 3.0.0, CMS 9.12, MVC
I had problem with the Forms javascript not beeing in the output, got errors like
ReferenceError: epi is not defined
or when logged in
ReferenceError: epi.Forms is not defined
Firstly, I have followed other forum threads pointing out the importance of having
@Html.RequiredClientResources(“Header”) and @Html.RequiredClientResources(“Footer”)
- http://world.episerver.com/forum/developer-forum/-EPiServer-75-CMS/Thread-Container/2016/1/quotuncaught-referenceerror-epi-is-not-definedquot-when-displaying-a-form-the-new-episerver-forms/
- http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=148419
If that’s not enougth you probably have a layout strategy with only @RenderSections, then it means that you FORM is placed inside @RenderSection. The @Html.RequiredClientResources(“Header”) happens before the FormContainerBlockController. When the FormContainerBlockController is executed, the page already rendered the header, so FORM cannot add required resources to the header. In order to solve this problem, please move FORM outside @RenderSection into the @RenderBody.
I know some fellows that did solve it by inheriting their main _layout.cshtml to a master view only with a @RenderBody
@{ } @RenderBody()
Worth a shot, but it didn’t work for me.
Regarding Form Submissions!
While uppgrading manualy the nuget packages using -IgnoreDependencies, i did upgrade Newtonsoft.Json to far, version over 9 is not supported by today. So check the requirements!