具体请参考 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. IOS 系统API---NSJSONSerialization四个枚举什么意思

    IOS 系统API---NSJSONSerialization四个枚举什么意思 NSJSONReadingMutableContainers:返回可变容器,NSMutableDictionary或NS ...

  2. 【转】windows c++获取文件信息——_stat函数的使用

    _stat函数的功能 _stat函数用来获取指定路径的文件或者文件夹的信息. 函数声明 int _stat( const char *path, struct _stat *buffer ); 参数: ...

  3. SPRING IN ACTION 第4版笔记-第九章Securing web applications-010-拦截请求

    一. What if you wanted to restrict access to certain roles only on Tuesday? Using the access() method ...

  4. c# 可访问性级别

    使用访问修饰符 public.protected.internal 或 private 可以为成员指定以下声明的访问级别之一.   声明的可访问性 含义 public 访问不受限制. protecte ...

  5. POJ2993——Help Me with the Game(字符串处理+排序)

    Help Me with the Game DescriptionYour task is to read a picture of a chessboard position and print i ...

  6. hadoop博客

    http://www.cnblogs.com/scotoma/ http://www.cnblogs.com/xia520pi/

  7. bzoj1070

    平均时间最短即总时间最短 首先不难想到,将每个工作人员拆成n个点 然后,我就卡住了, 的确,正向建图确实很难,因为我们不好表示在修第i个车之前,前面用了多少时间 于是我们应该逆向想一想,将这辆车作为某 ...

  8. CodeForces Round #286 Div.2

    A. Mr. Kitayuta's Gift (枚举) 题意: 给一个长度不超过10的串,问能否通过插入一个字符使得新串成为回文串. 分析: 因为所给的串很多,所以可以枚举 “在哪插入” 和 “插入什 ...

  9. 自定义View 实现软键盘实现搜索

    1. xml文件中加入自定义 搜索view <com.etoury.etoury.ui.view.IconCenterEditText android:id="@+id/search_ ...

  10. (转)MySQL数据库引擎ISAM MyISAM HEAP InnoDB的区别

    转自:http://blog.csdn.net/nightelve/article/details/16895917 MySQL数据库引擎取决于MySQL在安装的时候是如何被编译的.要添加一个新的引擎 ...