AI OnAI Off
This isn't something I've done, but you could override the PartialView
method when implementing the controller for your custom form.
Let's say, for example, you custom form was given the original name CustomFormContainerBlock
then your controller could look like this:
[TemplateDescriptor(
AvailableWithoutTag = true,
Default = true,
ModelType = typeof(CustomFormContainerBlock),
TemplateTypeCategory = TemplateTypeCategories.MvcPartialController)]
public class CustomFormContainerBlockController : FormContainerBlockController
{
protected override PartialViewResult PartialView(string viewName,object model)
{
return base.PartialView(nameof(CustomFormContainerBlock), model);
}
}
Disclaimer: apparently I cannot post links on the forum cause my account hasn't associated to a company
I am following the guide regarding custom forms on develop guides.
It tells you to copy FormContainerBlock.ascx from the zip file to your configured viewpath. It also tells you to use the filename as is. And the controller from which you inherit (FormContainerBlockController) actually has hardcoded the viewpath.
So you cannot really have multiple views for the formcontainer. Why not have it like the elements that the view will corrospond to the typename of the FormContainer model (or maybe the controller)? Also it could fall back to using FormContainerBlock.ascx if no other is available.
Was this changed, cause there are forum thread here on world that actually states that it load a view corrosponding to the model. But it could also be that an action filter hooks in and change the view path ...