Try our conversational search powered by Generative AI!

Breaking change in Forms 5.6.0?

Vote:
 

We have a page which includes two forms in which we inherit from "FormContainerBlockController" to add on some extra functionallity to our forms. We then render our extra stuff and pass the form container to the regular views like this.

@await Html.PartialAsync("~/FormsViews/Views/ElementBlocks/Components/FormContainerBlock/FormContainerBlock.cshtml", Model.FormContainerBlock)
This worked fine before 5.6.0 but after upgrading to that an exception is throw in "FormContainerBlock.cshtml".
Cannot convert null to 'bool' because it is a non-nullable value type
This happens on line 164 which looks like this.
var validationCssClass = ViewBag.ValidationFail ? "ValidationFail" : "ValidationSuccess";
After some debugging (and ILSpy deompilation) we noticed that this check has been added to "FormConntainerBlockController" which stops our second form from being initialized.
if(base.RouteData.DataTokens["EPi:InsideFormBlock"] != null && (bool)base.RouteData.DataTokens["EPi:InsideFormBlock"]) {
  return Content(string.Empty);
}
The DataToken "EPi:InsideFormBlock" isn't reset between the two form rendering even though they are different blocks and different forms all together. I looked through the release notes at https://world.optimizely.com/documentation/Release-Notes/ but didn't see anything that sounded like it whould have needed this.
Is this intended behaviour? If so, can't we use multiple forms on the same page anymore?
#306897
Edited, Aug 16, 2023 15:36
Johan Kronberg - Sep 06, 2023 16:00
I'm also troubleshooting issue with only the first form in a page rendering after upgrading to 5.6.0 (I think we were on 5.5.0 in the Prod version before). Just started looking at it...
Johan Kronberg - Sep 06, 2023 19:58
Did you create a ticket with support?
Vote:
 

I haven't no, I did a quick workaround where I simply remove the DataToken before rendering my form and it worked. Haven't had time to go back to ít though.

    protected override IViewComponentResult InvokeComponent(FormContainerBlock currentContent) {
        RouteData.DataTokens.Remove("EPi:InsideFormBlock");

        return base.InvokeComponent(currentContent);
    }
#308121
Sep 07, 2023 5:06
Vote:
 

Was in contact with support and got some information:

The bug has been fixed in the Episerver.Forms 5.6.1 which has not been released yet ..
You can follow the bug at this link:
https://world.optimizely.com/support/bug-list/bug/AFORM-3478

#308124
Sep 07, 2023 6:44
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.