Hi,
Have anyone figured out how to load scripts before </body> in Forms v7? I'm calling the macro InsertUmbracoFormWithTheme manually in my template, where I set ExcludeScripts = "0", which prevents the code in Scripts.cshml in my theme from running. So far so good.
You can still do this in v7, if you create the macro in Umbraco, and point it to the macro partial called RenderUmbracoFormScripts.cshtml. But this will load the old scripts, which are still present for some reason.
What I'd like, is a way to run the code in Scripts.cshtml in my theme folder at a point of my selection. Essentially the code in Scripts.cshtml loads the script files in App_Plugins/UmbracoForms/Assets/themes/your-theme instead of the old script files located in App_Plugins/UmbracoForms/Assets/.
However, I noticed that when I insert the InsertUmbracoFormWithTheme macro in an RTE, everything works perfectly 🤔
Loading form scripts in forms v7.x.x
Hi, Have anyone figured out how to load scripts before
</body>
in Forms v7? I'm calling the macroInsertUmbracoFormWithTheme
manually in my template, where I setExcludeScripts = "0"
, which prevents the code inScripts.cshml
in my theme from running. So far so good.What I haven't figured out, is how I can control where to render the scripts. In the previous version, you could just follow this from the documentation https://our.umbraco.org/documentation/Add-ons/UmbracoForms/Developer/Rendering-Scripts/ .
You can still do this in v7, if you create the macro in Umbraco, and point it to the macro partial called
RenderUmbracoFormScripts.cshtml
. But this will load the old scripts, which are still present for some reason.What I'd like, is a way to run the code in
Scripts.cshtml
in my theme folder at a point of my selection. Essentially the code inScripts.cshtml
loads the script files inApp_Plugins/UmbracoForms/Assets/themes/your-theme
instead of the old script files located inApp_Plugins/UmbracoForms/Assets/
.However, I noticed that when I insert the
InsertUmbracoFormWithTheme
macro in an RTE, everything works perfectly 🤔Anyone had succes with this? Thanks!
Hi OleP,
Yes - it's not easy - and part of the reason is that the docs are a little confusing now that there are two versions.
You need to look at the bottom of the "Themes" docs for a hint to this: https://our.umbraco.org/documentation/Add-ons/UmbracoForms/Developer/Themes/#rendering-script-content-separately
I've wasted several hours trying to do this and then having my changes overwritten by an UmbracoForms upgrade on Cloud...
Make sure to create your own theme files instead of modifying the built-in ones (macro partials and views).
Hope that helps,
/Chriztian
THANK YOU!
I feel stupid for spending so many hours trying to set this up correctly, and then the answer is so simple and RIGHT THERE!
is working on a reply...