Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Darren Hunter 99 posts 190 karma points
    Oct 24, 2022 @ 15:16
    Darren Hunter
    0

    Umbraco Forms not Rendering correctly in Umbraco 10.

    Hi,

    I am trying to update a .Partial View Macro Page from:

    @inherits Umbraco.Web.Macros.PartialViewMacroPage

    to @inherits Umbraco.Cms.Web.Common.Macros.PartialViewMacroPage @using Umbraco.Cms.Core.Models; @using ContentModels = Umbraco.Cms.Web.Common.PublishedModels; @inject Microsoft.AspNetCore.Http.IHttpContextAccessor HttpContextAccessor

    But when I run the the following line of code

    Html.RenderPartial("RenderForm", "UmbracoForms", new ViewDataDictionary(ViewData));

    It says it can't find the view. The original code on version 8 of umbraco is

    Html.RenderAction("RenderForm", "UmbracoForms", new {formId = form, recordId = recordGuid, theme = theme, includeScripts = true });

    What the correct code I need to use,

  • Marc Goodson 2126 posts 14217 karma points MVP 8x c-trib
    Oct 27, 2022 @ 19:15
    Marc Goodson
    0

    HI Darren

    If I understand correctly I think you need something like this on V10

    var formGuid = "TheGuidOfYourFormFromAPickerOrSomething";
    var yourThemeName = "NameOfYourFormsTheme";
    @await Umbraco.RenderMacroAsync("renderUmbracoForm", new {FormGuid=formGuid, FormTheme=yourThemeName , ExcludeScripts="0"})
    

    having ExcludeScripts ="0" or "1" depending on fi you want to have them included or if they are in your front end build.

    regards

    Marc

  • Darren Hunter 99 posts 190 karma points
    Oct 28, 2022 @ 07:35
    Darren Hunter
    0

    Thank you

Please Sign in or register to post replies

Write your reply to:

Draft