November Happy Hour will be moved to Thursday December 5th.

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
Arjan Paauw - Jul 03, 2024 5:24
Just what I ran into, thanks!
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
Vote:
 

You might get the console warning, not error, as shown below. You will see it when the form is valid and you try to submit it. Then check you FormContainerInitScript as well.

epi.EPiServer.SystemSettings is undefined

#327862
Edited, Aug 22, 2024 8:38
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.