1

I'm working with Sitecore/SXA 9.3. I have a form built in FormBuilder added to a page via SXA's Sitecore Form Wrapper component. Standard form, only thing notable is Ajax submit is disabled (because I plan to use a redirect action eventually) and no actions have been set on the submit button initially. Form appears to render fine, validation works as well.

I expect that when I submit the form, nothing will happen other than resetting the form state. However, when I submit the form, I get this error:

[NullReferenceException: Object reference not set to an instance of an object.]
   Sitecore.ExperienceForms.Mvc.Controllers.BaseFormBuilderController.ProcessFormData(FormDataModel data) +66
   Sitecore.ExperienceForms.Mvc.Controllers.FormBuilderController.Index(FormDataModel data) +54
   lambda_method(Closure , ControllerBase , Object[] ) +138
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +34
   System.Web.Mvc.<>c__DisplayClass24_0.<InvokeActionMethodWithFilters>b__0() +79
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +490
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +490

I'm not sure what I'm doing wrong. I've confirmed the Forms JS is being added to the page, and the validation works fine. I've tried setting the submit action to save and redirect as well, same error whether I have submit actions set or not.

I disassembled the code to see what's going in ProcessFormData. From the looks of it, I suspect something may be up client-side that's somehow messing up the form data population and breaking the submit, but I'm not sure. Not seeing any obvious JS errors in the console. There's no custom code called in this form, only customization is styling and setting up required fields in FormBuilder.

I saw this post: Sitecore Forms Save submit action null FormDataModel

I discussed with our FE lead; she said none of JS has been minified yet, so I don't think the solution outlined in that post will solve it for me.

Any ideas?

1 Answer 1

2

I have answered the question you linked with some steps to troubleshoot this - but I will also answer here with an additional finding due to this question regarding SXA specifically.

I found an issue where forms embedded in overlays in SXA (versions 1.9 and 9.3) will have this issue due to this bug in the component-overlay.js of the components theme which has this on line 311:

overlayContent.on("click", function (event) {
event.stopPropagation();
});

That event needs to propogate to set the Submit button values which get serialized by the jquery unobstrusive ajax handler. This has been raised as a bug to Sitecore Support and has reference number 395458.

3
  • could you please advise if there a fix package provided by sitecore regarding this issue?
    – NAli
    Oct 19, 2020 at 16:37
  • I didn't ask for one as I fixed myself. Oct 19, 2020 at 23:33
  • Hi may i know how you fixed this? I have the same problem
    – Vsn
    Apr 13, 2021 at 21:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.