Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

BUG: EPiServer.Forms 5.8.2. Jquery error prevents forms from being submitted

Vote:
 

I've just upgraded from EpiServer.Forms 5.8.0 to EpiServer.Forms 5.8.2 and now I get this error message when trying to submit a form.

jquery-3.5.1.min.js:2 jQuery.Deferred exception: Cannot read properties of undefined (reading 'RequestVerification') TypeError: Cannot read properties of undefined (reading 'RequestVerification')
    at Object.getAntiForgeryToken (https://local.bravida.se/Util/EPiServer.Forms/EPiServerForms.js:866:80)
    at Object.buildSubmitRequestHeader (https://local.bravida.se/Util/EPiServer.Forms/EPiServerForms.js:875:37)
    at _doSubmitForm (https://local.bravida.se/Util/EPiServer.Forms/EPiServerForms.js:2162:44)
    at https://local.bravida.se/Util/EPiServer.Forms/EPiServerForms.js:1944:25
    at e (https://local.bravida.se/Util/EPiServer.Forms/jquery-3.5.1.min.js:2:30005)
    at t (https://local.bravida.se/Util/EPiServer.Forms/jquery-3.5.1.min.js:2:30307) undefined

These are the form packages that my project is using and I've upgraded each one by one to test which one is the culprit and after upgrading Episerver.Forms to 5.8.2 this error occurs (after upgrading both .Core and .Ui to 5.8.2). On 5.8.0 it works as expected.

<PackageReference Include="EPiServer.Forms" Version="5.8.2" />
<PackageReference Include="EPiServer.Forms.Core" Version="5.8.2" />
<PackageReference Include="EPiServer.Forms.Samples" Version="4.2.2" />
<PackageReference Include="EPiServer.Forms.UI" Version="5.8.2" />
#322598
May 24, 2024 6:53
Vote:
 

Have you by any chance overriden FormContainerInitScript.cshtml file by placing it in your project ? The package adds some antiforgery stuff in the file (epi.EPiServer.SystemSettings at the bottom) you might be missing after the upgrade. Adding that section manually should fix the issue

#322726
May 27, 2024 12:43
Vote:
 

Oooh, yeah I have and since it was a minor update I didn't think about checking for new updated views.

#322824
May 29, 2024 11:00
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.