具体请参考 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. 阿里云 EDAS-HSF 用户指南

    阿里云 EDAS-HSF 用户指南 针对 EDAS v2.3.0©Alibaba EDAS 项目组2015/8/19 1 前言本文档旨在描述阿里云 EDAS 产品中应用服务化模块的基本概念,以及如何使 ...

  2. 企业级 Linux 安全管理实例(1)

    公司企业多用Linux服务器,其中涉及到的一些安全管理对于安全运维人员来说是必不可少的应知技能, 以下案例沿着背景->需求->具体要求->操作步骤的流程进行描述,可以加深对安全管理的 ...

  3. node.js EventEmitter发送和接收事件

    EventEmitter是nodejs核心的一部分.很多nodejs对象继承自EventEmitter,用来处理事件,及回调.api文档地址: http://nodejs.org/api/events ...

  4. 锋利的JQuery-Jquery中的事件和动画

    有时候觉得这些内容都好简单,真想看看就算了. 事件绑定 bing(type [,data],fn) 第一个参数:事件类型包括:blur,focus,load,resize,scroll,unload, ...

  5. Playing with cubes II

    Description: Hey Codewarrior! You already implemented a Cube class, but now we need your help again! ...

  6. OneNote快捷键

    转载自:http://onenoter.com/2013/04/5792 记录笔记和设置笔记格式 键入和编辑笔记 若要执行此操作 按 打开一个新的 OneNote 窗口. Ctrl+M 打开一个小的 ...

  7. MAC 上搭建lua环境

    一.下载并安装 (1)最新release版下载地址 http://www.lua.org/ftp/lua-5.3.1.tar.gz (2)编译 Building Lua is implemented ...

  8. poj1195Mobile phones(二维树状数组)

    http://poj.org/problem?id=1195 模版题 i写成k了 找了一个多小时没找出来.. #include <iostream> #include<cstring ...

  9. bzoj3196

    平衡树系列终于完结,撒花 裸的树套树,扔代码跑 ; ..] of longint; son:..,..] of longint; a,root:..*] of longint; i,n,m,x,y,k ...

  10. bzoj2245

    这道题还是比较简单的费用流,由于w是递增的 实际上,这题数据还可以强一点,比如说分段函数不保证费用递增, 就要加一点技巧了(要保证函数的顺序) ; type node=record        ne ...