Don't miss out Virtual Happy Hour today (April 26).

Try our conversational search powered by Generative AI!

Episerver Forms - Creating a wrapper FormContainerBlock

Vote:
 

I've built a FormContainerWithNavigationBlock that is meant to wrap the original FormContainerBlock.  I've got it wired up and it's mostly working, however when I call the original FormContainerBlock.ascx, it's returning an "Object reference not set to an instance of an object" exception.  Is this the correct path to the original FormContainerBlock view?

@using EPiServer.Core
@using EPiServer.Forms.Implementation.Elements

@model Reyes.Episerver.Model.Models.Block.FormContainerWithNavigationBlock

@{
    if (Model != null && Model.ElementsArea.Items.Any())
    {
        var formStepItems = Model.ElementsArea.Items.Where(x => x.GetContent() is FormStepBlock);

        
    }
}

@Html.Partial("/Episerver/EPiServer.Forms/Views/ElementBlocks/FormContainerBlock.ascx", Model)
#182773
Sep 28, 2017 21:16
Vote:
 

Moving my view to ~/views/Shared/ElementBlocks/ as specificed in ~/modules/_protected/EPiserver.Forms/forms.config resolved my issue.

#182777
Sep 29, 2017 0:34
Vote:
 

Hey, I answered here, but essentially, if you just want to change rendering of FormsContainerBlock, it's way easier to just override the view by copying it to Views/Shared/ElementBlocks.

#182882
Sep 29, 2017 11:19
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.