Copied to clipboard

Flag this post as spam?

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


  • Mark 8 posts 110 karma points
    May 14, 2017 @ 10:45
    Mark
    0

    Umbraco Forms 6.0.1 jQuery Placement

    Hi,

    I was having some issues with Umbraco Forms in so much as, although it was installed, when I went to the form screen it would ask me to install it. So I uninstalled it and was then unable to install it except to download it and do it as a local package.

    Now, when I view a page with a form on it, I get the wonderful:

    jQuery has not been loaded & is required for Umbraco Forms.
    See Umbraco Forms Documentation
    

    I've followed the instructions about rendering scripts where I want (at the bottom, like normal people) but it still shows the error.

    Strangely, I didn't have a 'Render Umbraco Form Scripts' macro so had to create that manually. I've changed the

    mode="scripts" 
    

    to

    mode="form"
    

    but still get the error

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    May 24, 2017 @ 14:29
    Alex Skrypnyk
    0

    Hi Mark

    Just tried to install Umbraco forms and I have the same issue as you.

    I hadn't a 'Render Umbraco Form Scripts' macro so had to create that manually and it's not working event after creating it manually and adding to the template.

    Thanks,

    Alex

  • Nico 10 posts 77 karma points
    Nov 08, 2017 @ 04:10
    Nico
    0

    This. A big problem with Umbraco documentation is the partial solutions. Below the solution is indeed correct, but only half so after the 'Render Umbraco Form Scripts' macro has to be manually created.

    Why is this documentation still outdated on the official umbraco documentation?

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    May 24, 2017 @ 14:32
    Alex Skrypnyk
    0

    But it started to work only when I added manually jquery to the template before Forms scripts:

    <script src="/js/jquery.min.js"></script>
    
  • Mark 8 posts 110 karma points
    May 24, 2017 @ 16:12
    Mark
    102

    Hi Alex,

    Here's how I got it to work:

    Go to -> Developers -> Partial View Macro Files -> InsertUmbracoFormWithTheme.cshtml -> at the end of this page you'll see something along the lines of:

    Html.RenderAction("RenderForm", "UmbracoForms", new {formId = form, recordId = recordGuid, theme = theme, includeScripts = includeScripts }); ​ 
    
    change it to:
    
    Html.RenderAction("Render", "UmbracoForms", new {formId = form, mode = "form", recordId = recordGuid, theme = theme, includeScripts = includeScripts }); 
    
  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    May 25, 2017 @ 10:34
    Alex Skrypnyk
    0

    Hi Mark

    It works, great example, thank you.

    Have a great day!

    Alex

  • Martin 278 posts 662 karma points
    Jan 18, 2018 @ 10:30
    Martin
    0

    Hi Alex & Mark,

    Did you manage to get this work with a custom theme?

    Added the above fixes the jquery error, but it make the forms use the base theme.

    Any idea how to use it with a theme?

    Thanks

  • Matt Barlow | jacker.io 164 posts 740 karma points c-trib
    Feb 21, 2018 @ 21:32
    Matt Barlow | jacker.io
    0

    The documentation for Umbraco forms is terrible. I'll second the comment from Martin, how do we render the footer scripts to get the theme?

    I have this:

      Html.RenderAction("RenderFormScripts", "UmbracoForms", new { formid = form, theme = "yourTheme" });
    

    But it still picks up the default theme rather than the theme I set.

  • Arnold Visser 418 posts 778 karma points hq c-trib
    Mar 30, 2018 @ 08:04
    Arnold Visser
    0

    Try to add the mode = "form" to the end of the RenderAction:

    Html.RenderAction("RenderForm", "UmbracoForms", new {formId = form, recordId = recordGuid, theme = theme, includeScripts = false, mode = "form" });
    
  • Heather Floyd 604 posts 1002 karma points MVP 5x c-trib
    Jan 23, 2019 @ 22:45
    Heather Floyd
    0

    I have noticed the same issue -

    I was having a similar issue with the red "jQuery Validate has not been loaded & is required for Umbraco Forms" message appearing after a recent auto-update to Forms 7.0.6 (via Umbraco Cloud).

    When I made Mark's recommended change, the JavaScript issue went away, but it seems that the "Render" action doesn't pass through to the theme's "Form.cshtml" file, it uses the one at "\Views\Partials\Forms\Form.cshtml"

    While stepping through code, I noticed that when the generic "Form.cshtml" file is hit, the model (Umbraco.Forms.Mvc.Models.FormViewModel) has a "Theme" property of null - even though the "Theme" WAS present in "InsertUmbracoFormWithTheme.cshtml" while stepping through.

    It seems like this is a bug inside the UmbracoForms "Render" controller.

  • Heather Floyd 604 posts 1002 karma points MVP 5x c-trib
    Jan 24, 2019 @ 16:54
    Heather Floyd
    0

    Okay, I contacted Umbraco Cloud support and was advised to make sure the option "Exclude Scripts" is CHECKED when inserting the macro onto a page. When I changed the macro back to using:

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

    AND made sure the macro parameters were set to Exclude Scripts on each page using the forms, it worked - the JQuery message went away AND my theme was in use. :-)

Please Sign in or register to post replies

Write your reply to:

Draft