具体请参考 https://our.umbraco.org/documentation/products/umbracoforms/developer/Rendering-Scripts/

转载 https://our.umbraco.org/documentation/products/umbracoforms/developer/Rendering-Scripts/

Rendering Forms scripts where you want

Besides markup Forms will also output some JavaScript, by default this JavaScript is outputted just below the markup. If you wish to change this behaviour follow the next steps (like if all your js is rendered at the bottom of you page)

Change the Forms partial view macro

First we'll need to tell the Forms partial macro (that is used to render forms) to only render the markup and not the scripts. Navigate to the developer section and open the > Partial View Macro File > Insert Umbraco Form

It should have the following contents

@inherits Umbraco.Web.Macros.PartialViewMacroPage

@if (Model.MacroParameters["FormGuid"] != null)
{
var s = Model.MacroParameters["FormGuid"].ToString();
var g = new Guid(s); Html.RenderAction("Render", "UmbracoForms", new {formId = g});

Here we'll make a small change, in the RenderAction call we'll provide an additional argument mode = "form"

so go from

Html.RenderAction("Render", "UmbracoForms", new {formId = g});  

to

Html.RenderAction("Render", "UmbracoForms", new {formId = g, mode = "form"});

Place the Render scripts macro on your template

Now we'll need to let Forms know where we want to output the script instead. So Navigate to the settings section and select  your template that should contain the scripts. There simply insert the Render Umbraco Forms Scripts macro.

比如,我们想把Forms 的scripts包含在master template中,那么就在master template 中的尾部 Insert Macro - Render forms scripts

系统会自动产生 语句 @Umbraco.RenderMacro("FormsRenderScripts") 放在master template的尾部

Umbraco Forms 使Rendering Forms scripts 在不同的template中的更多相关文章

  1. Linux Vi进入编辑模式后使用方向键的时候,并不会使光标移动,而是在命令行中出现A、B、C、D四个字母

    在linux下,初始使用Vi的时候有两个典型的问题: 1.在编辑模式下使用方向键的时候,并不会使光标移动,而是在命令行中出现A.B.C.D四个字母: 2.当编辑出现错误,想要删除时,发现Backspa ...

  2. C#Windows Forms 使MessageBox顶层显示--xdd

    方法1. MessageBox.Show("Text", "Caption", MessageBoxButtons.OK, MessageBoxIcon.Inf ...

  3. POJ 3294 Life Forms 后缀数组+二分 求至少k个字符串中包含的最长子串

    Life Forms   Description You may have wondered why most extraterrestrial life forms resemble humans, ...

  4. forms.ModelForm 与 forms.Form

    1. 首先 两者都是forms里的常用类. 2. 这两个类在应用上是有区别的.一般情况下,如果要将表单中的数据写入数据库或者修改某些记录的值,就要让表单类继承ModelForm; 如果提交表单后 不会 ...

  5. POJ-3294-Life Forms(后缀数组-不小于 k 个字符串中的最长子串)

    题意: 给定 n 个字符串,求出现在不小于 k 个字符串中的最长子串. 分析: 将 n 个字符串连起来,中间用不相同的且没有出现在字符串中的字符隔开,求后缀数组. 然后二分答案,将后缀分成若干组,判断 ...

  6. Life Forms POJ - 3294(不小于k个字符串中的最长子串)

    题意: 求不小于字符串一半长度个字符串中的最长字串 解析: 论文题例11 将n个字符串连起来,中间用不相同的且没有出现在字符串中的字符隔开, 求后缀数组, 然后二分答案变为判定性问题, 然后判断每组的 ...

  7. js 使某个页面不允许在子iframe中打开的解决办法

    在页面中添加如下js代码<script> if (window.parent !== window.self) { window.parent.location.reload(); }&l ...

  8. 呃,如何使 .NET 程序,在 64位 系统 中,以 32位 模式运行。

    其实最简单的方法就是在解决方案中,把平台设为 x86 就好了哈~   但是今天遇到一个第三方的软件,它调用的一个 dll 是 32位 的,可能它没有测试过在 64位 系统下运行的情况,它在编译时是按默 ...

  9. mybatis generator如何定制JavaTypeResolver,使smallint类型的数据库字段在po中的类型为Integer?

    一.问题概述 忙了一段时间的jenkins持续集成,又要开始开发任务了.这两天在用mybatis generator来逆向生成dao层工程. 其中一个问题在于,组长在设计表的时候,不少枚举使用了sma ...

随机推荐

  1. mvc学习

    视频: http://edu.51cto.com/index.php?do=lession&id=14581 博客: http://www.cnblogs.com/chsword/archiv ...

  2. SwapEffect 枚举(定义交换效果)

    由于创建设备时要用到这个值,所以在这里总结一下,以免以后再找. 首先引自msdn: Copy 只能为构成单个后台缓冲区的交换链指定此交换效果. 无论交换链是有窗口的还是全屏的,运行库都保证 Devic ...

  3. 强强合体:Docker版Kali Linux发布

    Kali Linux是一款开源的基于Debian的渗透测试专用操作系统,系统中包含一系列用于渗透测试的神器.最近,Kali的开发者们为喜爱Docker的童鞋们发布了新版本. FreeBuf百科:什么是 ...

  4. Django QuerySet API文档

    在查询时发生了什么(When QuerySets are evaluated) QuerySet 可以被构造,过滤,切片,做为参数传递,这些行为都不会对数据库进行操作.只要你查询的时候才真正的操作数据 ...

  5. P127、面试题20:顺时针打印矩阵

    题目:输入一个矩阵,按照从外向里以顺时针的顺序依次打印出每一个数字.例如:如果输入如下矩阵:1  2  3  4 5  6  7  89  10  11  1213  14  15  16则依次打印出 ...

  6. mongoDB入门必读

    一.概述 MongoDB是一个基于分布式文件存储的数据库开源项目. 由C++语言编写,旨在为WEB应用提供可护展的高性能数据存储解决方案. MongoDB是一个介于关系数据库和非关系数据库之间的产品. ...

  7. easyui返回数据类型

    /** * 我申请的事项List * * @param personalParamVo * @param pagePara * @return */ @ResourceMapping("my ...

  8. ARM7ldr指令与ldr伪指令

    ldr伪指令的第二个操作数之前有个=,意思是第一个操作书 = 第二个操作数,相当明了 核心就在于对于用.word指令在.text段里另外定义一段内存,用ldr r0,[pc + x(可以算出.text ...

  9. Nhibernate与Dapper对比,及Nhibernate增删改和9种查询语法

    1,Sql语法. NH:HQL Dapper:原生Sql. 点评:原生Sql可以直接放在数据库里执行,Hql不行,且Hql增加学习负担.(Hn也可以原生Sql,但好像用的不多呀) 2,开发速度. NH ...

  10. [swustoj 679] Secret Code

    Secret Code 问题描述 The Sarcophagus itself is locked by a secret numerical code. When somebody wants to ...