「Storefrontブランド テーマ」SXAテーマが使用されているページからSitecore Formを送信するとエラーが発生する


解説

コマースSXAのテーマである「Storefrontブランド テーマ」を使用しているページでSitecore Experience Formを送信すると、ブラウザー コンソールに次のエラーが発生します。

Uncaught TypeError: Cannot read property 'parse' of undefined
    at HTMLFormElement.eval (eval at c (jquery.unobtrusive-ajax.min.js:19), <anonymous>:3:130)
    at Object.success (jquery.unobtrusive-ajax.min.js:19)
    at l (jquery-2.1.3.min.js:14)
    at Object.fireWith [as resolveWith] (jquery-2.1.3.min.js:14)
    at p (jquery-2.1.3.min.js:14)
    at XMLHttpRequest.<anonymous> (jquery-2.1.3.min.js:14)
Uncaught TypeError: Cannot read property 'parse' of undefined
    at Object.eval (eval at i (optimized-min.js?t=20180517T132054Z:19), <anonymous>:3:130)
    at Object.success (optimized-min.js?t=20180517T132054Z:19)
    at c (optimized-min.js?t=20180517T132054Z:14)
    at Object.fireWith [as resolveWith] (optimized-min.js?t=20180517T132054Z:14)
    at b (optimized-min.js?t=20180517T132054Z:14)
    at XMLHttpRequest.<anonymous> (optimized-min.js?t=20180517T132054Z:14)

解決策

  1. Formアイテムの「Scripts」フィールドから「jquery-2.1.3.min.js」を削除します。
  2. 「\Views\SxaLayout\SxaLayout.cshtml」ファイルを変更して、SXAスクリプトがページの上部にレンダリングされるようにします。
    <head>
      @foreach (string style in assetLinks.Styles)
      {
        @Html.Raw(style)
      }
      @foreach (string script in assetLinks.Scripts)
     {
       @Html.Raw(script)
     }
      @Html.Sitecore().VisitorIdentification()