$scw(...).eventTracking 不是 Sitecore MVC 中 WFFM 的函数
$scw(...).eventTracking is not a function in the WFFM in Sitecore MVC
我在使用 sitecore MVC 的营销人员的 Web 表单方面遇到了问题我能够在 MVC 视图上呈现 WFFM 当我呈现这个时我在控制台上遇到错误:
http://screencast.com/t/GMsjXnCbph
& 当我提交这个 genarate en 错误时:
http://screencast.com/t/sbDl7LCe
任何人都可以帮我解决这个问题,同样的表单在 Web 布局中工作正常问题只在 MVC 布局中出现
您似乎遇到了两个不同的问题。
我不确定你为什么得到一个空引用,确保你在 MVC 页面上使用 MVC 表单,并且你的自定义代码命名表单中没有控制器。 'Sitecore.MVC.Config' 文件中的默认表单路由也需要为空。
至于 JavaScript 错误,是因为事件跟踪脚本从未添加到页面。这似乎是一个错误,我已将其报告给 Sitecore。
虽然现在您可以手动将脚本添加到 WFFM razor 视图。
我把它添加到 ~/views/form/index.cshtml
<script src="~/sitecore/shell/Applications/Modules/Web Forms for Marketers/mvc/Fields/sc.fields-events-tracking.js"></script>
编辑:我现在发现在 WFFM 参考指南中它实际上说您需要手动将所有 css 和 js 文件添加到您的主布局文件中。它被埋在第 3.15.2 节中。
您需要添加这些 js 文件引用:
<script src="~/sitecore/shell/Applications/Modules/Web Forms for Marketers/mvc/jquery-1.8.2.min.js"></script>
<script src="~/sitecore/shell/Applications/Modules/Web Forms for Marketers/mvc/jquery-ui-1.8.24.js"></script>
<script src="~/sitecore/shell/Applications/Modules/Web Forms for Marketers/mvc/jquery.validate.js"></script>
<script src="~/sitecore/shell/Applications/Modules/Web Forms for Marketers/mvc/jquery.validate.unobtrusive.js"></script>
<script src="~/sitecore/shell/Applications/Modules/Web Forms for Marketers/mvc/Fields/sc.fields-unobtrusive.js"></script>
<script src="~/sitecore/shell/Applications/Modules/Web Forms for Marketers/mvc/Fields/sc.fields-events-tracking.js"></script>
<script src="~/sitecore/shell/Applications/Modules/Web Forms for Marketers/mvc/Fields/sc.fields-date.js"></script>
<script src="~/sitecore/shell/Applications/Modules/Web Forms for Marketers/mvc/Fields/sc.fields-captcha.js"></script>
<script src="~/sitecore/shell/Applications/Modules/Web Forms for Marketers/mvc/Fields/sc.ajax-form.js"></script>
和这些 css 参考资料:
<link href="~/sitecore/shell/Themes/Standard/Default/WFM/mvc/Fields/Default.css" rel="stylesheet">
<link href="~/sitecore/shell/Themes/Standard/Default/WFM/mvc/Fields/Colors/Default.css" rel="stylesheet">
<link href="~/sitecore/shell/Themes/Standard/Default/WFM/mvc/Fields/Custom.css" rel="stylesheet">
<link href="~/sitecore/shell/Themes/Standard/Default/WFM/mvc/base/jquery.ui.all.css" rel="stylesheet">
.. 以及 Sitecore 版本 8.0-X
CSS参考:
<link href="~/sitecore modules/Shell/Web Forms for Marketers/Themes/mvc/Fields/Default.css" rel="stylesheet">
<link href="~/sitecore modules/Shell/Web Forms for Marketers/Themes/mvc/Fields/Colors/Default.css" rel="stylesheet">
<link href="~/sitecore modules/Shell/Web Forms for Marketers/Themes/mvc/Fields/Custom.css" rel="stylesheet">
<link href="~/sitecore modules/Shell/Web Forms for Marketers/Themes/mvc/base/jquery.ui.all.css" rel="stylesheet">
JS参考:
<script src="~/sitecore modules/Web/Web Forms for Marketers/scripts/mvc/jquery-1.8.2.min.js"></script>
<script src="~/sitecore modules/Web/Web Forms for Marketers/scripts/mvc/jquery-ui-1.8.24.js"></script>
<script src="~/sitecore modules/Web/Web Forms for Marketers/scripts/mvc/jquery.validate.js"></script>
<script src="~/sitecore modules/Web/Web Forms for Marketers/scripts/mvc/jquery.validate.unobtrusive.js"></script>
<script src="~/sitecore modules/Web/Web Forms for Marketers/scripts/mvc/Fields/sc.fields-unobtrusive.js"></script>
<script src="~/sitecore modules/Web/Web Forms for Marketers/scripts/mvc/Fields/sc.fields-events-tracking.js"></script>
<script src="~/sitecore modules/Web/Web Forms for Marketers/scripts/mvc/Fields/sc.fields-date.js"></script>
<script src="~/sitecore modules/Web/Web Forms for Marketers/scripts/mvc/Fields/sc.fields-captcha.js"></script>
<script src="~/sitecore modules/Web/Web Forms for Marketers/scripts/mvc/Fields/sc.ajax-form.js"></script>
我在使用 sitecore MVC 的营销人员的 Web 表单方面遇到了问题我能够在 MVC 视图上呈现 WFFM 当我呈现这个时我在控制台上遇到错误:
http://screencast.com/t/GMsjXnCbph
& 当我提交这个 genarate en 错误时:
http://screencast.com/t/sbDl7LCe
任何人都可以帮我解决这个问题,同样的表单在 Web 布局中工作正常问题只在 MVC 布局中出现
您似乎遇到了两个不同的问题。 我不确定你为什么得到一个空引用,确保你在 MVC 页面上使用 MVC 表单,并且你的自定义代码命名表单中没有控制器。 'Sitecore.MVC.Config' 文件中的默认表单路由也需要为空。
至于 JavaScript 错误,是因为事件跟踪脚本从未添加到页面。这似乎是一个错误,我已将其报告给 Sitecore。
虽然现在您可以手动将脚本添加到 WFFM razor 视图。
我把它添加到 ~/views/form/index.cshtml
<script src="~/sitecore/shell/Applications/Modules/Web Forms for Marketers/mvc/Fields/sc.fields-events-tracking.js"></script>
编辑:我现在发现在 WFFM 参考指南中它实际上说您需要手动将所有 css 和 js 文件添加到您的主布局文件中。它被埋在第 3.15.2 节中。
您需要添加这些 js 文件引用:
<script src="~/sitecore/shell/Applications/Modules/Web Forms for Marketers/mvc/jquery-1.8.2.min.js"></script>
<script src="~/sitecore/shell/Applications/Modules/Web Forms for Marketers/mvc/jquery-ui-1.8.24.js"></script>
<script src="~/sitecore/shell/Applications/Modules/Web Forms for Marketers/mvc/jquery.validate.js"></script>
<script src="~/sitecore/shell/Applications/Modules/Web Forms for Marketers/mvc/jquery.validate.unobtrusive.js"></script>
<script src="~/sitecore/shell/Applications/Modules/Web Forms for Marketers/mvc/Fields/sc.fields-unobtrusive.js"></script>
<script src="~/sitecore/shell/Applications/Modules/Web Forms for Marketers/mvc/Fields/sc.fields-events-tracking.js"></script>
<script src="~/sitecore/shell/Applications/Modules/Web Forms for Marketers/mvc/Fields/sc.fields-date.js"></script>
<script src="~/sitecore/shell/Applications/Modules/Web Forms for Marketers/mvc/Fields/sc.fields-captcha.js"></script>
<script src="~/sitecore/shell/Applications/Modules/Web Forms for Marketers/mvc/Fields/sc.ajax-form.js"></script>
和这些 css 参考资料:
<link href="~/sitecore/shell/Themes/Standard/Default/WFM/mvc/Fields/Default.css" rel="stylesheet">
<link href="~/sitecore/shell/Themes/Standard/Default/WFM/mvc/Fields/Colors/Default.css" rel="stylesheet">
<link href="~/sitecore/shell/Themes/Standard/Default/WFM/mvc/Fields/Custom.css" rel="stylesheet">
<link href="~/sitecore/shell/Themes/Standard/Default/WFM/mvc/base/jquery.ui.all.css" rel="stylesheet">
.. 以及 Sitecore 版本 8.0-X
CSS参考:
<link href="~/sitecore modules/Shell/Web Forms for Marketers/Themes/mvc/Fields/Default.css" rel="stylesheet">
<link href="~/sitecore modules/Shell/Web Forms for Marketers/Themes/mvc/Fields/Colors/Default.css" rel="stylesheet">
<link href="~/sitecore modules/Shell/Web Forms for Marketers/Themes/mvc/Fields/Custom.css" rel="stylesheet">
<link href="~/sitecore modules/Shell/Web Forms for Marketers/Themes/mvc/base/jquery.ui.all.css" rel="stylesheet">
JS参考:
<script src="~/sitecore modules/Web/Web Forms for Marketers/scripts/mvc/jquery-1.8.2.min.js"></script>
<script src="~/sitecore modules/Web/Web Forms for Marketers/scripts/mvc/jquery-ui-1.8.24.js"></script>
<script src="~/sitecore modules/Web/Web Forms for Marketers/scripts/mvc/jquery.validate.js"></script>
<script src="~/sitecore modules/Web/Web Forms for Marketers/scripts/mvc/jquery.validate.unobtrusive.js"></script>
<script src="~/sitecore modules/Web/Web Forms for Marketers/scripts/mvc/Fields/sc.fields-unobtrusive.js"></script>
<script src="~/sitecore modules/Web/Web Forms for Marketers/scripts/mvc/Fields/sc.fields-events-tracking.js"></script>
<script src="~/sitecore modules/Web/Web Forms for Marketers/scripts/mvc/Fields/sc.fields-date.js"></script>
<script src="~/sitecore modules/Web/Web Forms for Marketers/scripts/mvc/Fields/sc.fields-captcha.js"></script>
<script src="~/sitecore modules/Web/Web Forms for Marketers/scripts/mvc/Fields/sc.ajax-form.js"></script>