Copied to clipboard

Flag this post as spam?

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


  • Myles Broomes 1 post 71 karma points
    Nov 22, 2017 @ 16:35
    Myles Broomes
    0

    Forms Scripts Macro not rendering scripts

    Hello all,

    I'm trying to render form scripts using the following:

    @Umbraco.RenderMacro("FormsRenderScripts")
    

    ...but for some reason all that's being outputted is:

    <Macro:  (,)>
    

    Any reason why this might be happening? I've followed the documentation (https://our.umbraco.org/documentation/Add-ons/umbracoforms/developer/rendering-scripts/) to a tee and also scoured the forums but still can't get it to work :/ Thanks in advance.

  • Pedro Mendes 8 posts 119 karma points
    6 days ago
    Pedro Mendes
    0

    Hey there Myles,

    Don't know if you're still experience this issue but that happens because that macro - FormsRenderScripts - doesn't exist.

    I believe the docs are a little bit outdated, but still, here is my solution:

    1. Create a new Macro called, for example, "Forms Render Scripts" that uses the RenderUmbracoFormScripts view "~/Views/MacroPartials/RenderUmbracoFormScripts.cshtml"

    2. In the file ~/Views/MacroPartials/InsertUmbracoFormWithTheme.cshtml update line 47 from

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

    to

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

    3. In the template where you are calling all your other scripts, add

    @Umbraco.RenderMacro("FormsRenderScripts")
    

    4. Remove any umbracoForms.js and other scripts calls from your theme's Script.cshtml

    And that's about it.

    As a side note, I've updated my jQuery Validate and jQuery Validate Unobtrusive to the latest version, so I could use my jQuery v3 and it's all working fine - apparently at least :)

  • Chris Morley 10 posts 91 karma points
    3 days ago
    Chris Morley
    0

    Thanks for this Predo

    I was having the exact issue described above i couldn't figure out how to integrate the differences in the latest version (7.6.11) to the version documented. It was the creation of the new macro referencing the existing Render UmbracoForm Scripts which was the missing part for me

    Thanks

Please Sign in or register to post replies

Write your reply to:

Draft