Copied to clipboard

Flag this post as spam?

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


  • Luis Oliveira 21 posts 141 karma points
    Jan 23, 2020 @ 12:43
    Luis Oliveira
    1

    Error loading Partial View script (file:~/views/MacroPartials/InsertUmbracoFormWithTheme.cshtml)

    Hello everyone, i would apreciate if someone can help me with this error message i get when i'm editing a page with a form i have buid. I'm new at starting development umbraco pages and after search and read in tutorials and forum i still have my difficulties. The message are:

    Error loading Partial View script (file:~/views/MacroPartials/InsertUmbracoFormWithTheme.cshtml)

    When i preview or Save/publish the page with the form i can see it a live.

    Thank you

  • Joep 96 posts 698 karma points
    Jan 23, 2020 @ 17:26
    Joep
    0

    Hi,

    Are you inserting it as a macro into a richtexteditor? If so there is a bug regarding this. This will probably be fixed in the next version of Forms.

    -Joep

  • Luis Oliveira 21 posts 141 karma points
    Jan 23, 2020 @ 21:13
    Luis Oliveira
    100

    Hi Joep

    Yes i insert as macro into richtextedior. Thank you for the answer and help.

    luis

  • Niels Lynggaard 192 posts 550 karma points
    Mar 11, 2021 @ 15:30
    Niels Lynggaard
    0

    I'm having a similar issue with a site that has been ported from v7 to v8.

    We're using a Leblender control (shouldn't matter) to render in the grid with a form picker on it.

    But however, the "InsertUmbracoFormWithTheme" that calls RenderAction throws an error;

    The type or namespace name 'FormViewModel' could not be found (are you missing a using directive or an assembly reference?)

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

    We're using the latest forms 8.6

    EDIT: This also happens when inserting it as a Macro in the grid.. Here's the insertFormWithTheme.cshtml:

    @inherits Umbraco.Web.Macros.PartialViewMacroPage
    
    @if (Model.MacroParameters["FormGuid"] != null)
    {
        var s = Model.MacroParameters["FormGuid"].ToString();
        var theme = "";
        var includeScripts = true;
    
        @*
            If a theme is provided as a macro parameter, forms will attempt to use custom theme files
            ex: given the value "test", forms will look up views for the form and fields in a custom directory:
    
            Form will be rendered with
                /Views/Partials/Forms/Themes/test/form.cshml
    
            Fields will be rendered with
                /Views/Partials/Forms/Themes/test/FieldType/[fieldtypename].cshtml
    
            If a file is not available in the custom directory, forms will fallback to the default files in
                /Views/Partials/Forms/Themes/default/
        *@
    
        if(Model.MacroParameters.ContainsKey("FormTheme"))
        {
            theme = Model.MacroParameters["FormTheme"].ToString();
        }
    
        if (Model.MacroParameters.ContainsKey("ExcludeScripts"))
        {
    
            @*
                Inverse the boolean - RenderAction Parameter expects it to be false for exclusion
                But with default value for Macro Paramater boolean/checkbox being false 
                We want to ensure by default we include the scripts next to the form
            *@
            includeScripts = Model.MacroParameters["ExcludeScripts"].ToString() == "0";
        }
    
        var form = new Guid(s);
        var recordGuid = Guid.Empty;
    
        if (string.IsNullOrEmpty(Request.QueryString["recordId"]) == false)
        {
            Guid.TryParse(Request.QueryString["recordId"], out recordGuid);
        }
    
    
        Html.RenderAction("RenderForm", "UmbracoForms", new {formId = form, recordId = recordGuid, theme = theme, includeScripts = includeScripts });
    }
    

    What am I missing?

  • Niels Lynggaard 192 posts 550 karma points
    Mar 11, 2021 @ 15:50
    Niels Lynggaard
    0

    Nevermind, I just needed to update the old theme and direct the forms.cshtml file to the proper model, e.g;

    @inherits WebViewPage<Umbraco.Forms.Web.Models.FormViewModel>
    
  • Gurumurthy 54 posts 127 karma points
    Sep 27, 2023 @ 04:49
    Gurumurthy
    0

    Hello,

    I am facing the same issue with Umbraco v12.2, any suggestions on how to resolve this ?

    Error loading Partial View script (file:~/views/MacroPartials/InsertUmbracoFormWithTheme.cshtml)

    Thanks,

  • Jane Carol 22 posts 92 karma points
    Feb 23, 2024 @ 18:28
    Jane Carol
    0

    Did you find a solution for this? If so, Can you please share.

Please Sign in or register to post replies

Write your reply to:

Draft