<
From version < 13.2 >
edited by Paul Panțiru
on 2021/01/11
To version < 15.1
edited by Paul Panțiru
on 2021/01/11
Change comment: Rollback to version 10.1

Summary

Details

Page properties
Content
... ... @@ -15,16 +15,9 @@
15 15   $xwiki.jsx.use("Download.DownloadForm", {'downloadURL' : $escapetool.xml($request.downloadURL)})
16 16   <div class="download-container border-green subscribe-area">
17 17   <h3 class="subscribe">Join the Community!</h3>
18 - <script src="//app-lon03.marketo.com/js/forms2/js/forms2.min.js"></script>
19 - <form id="mktoForm_1319" class="marketoForm" style="display: none;"></form>
20 - <script>
21 - MktoForms2.loadForm("//app-lon03.marketo.com", "158-SNK-721", 1319, function(form){
22 - form.onSuccess(function(values, followUpUrl){
23 - // Prevent the Marketo Form from reloading the page
24 - return false;
25 - });
26 - });
27 - </script>
18 + <div class='webmecanik_form' style='display:none;'>
19 + <script type="text/javascript" src="//news.xwiki.com/form/generate.js?id=19"></script>
20 + </div>
28 28   <form id="emailForm" action="" class="xform">
29 29   <input type="hidden" name="downloadURL" value="$downloadURL"/>
30 30   <input type="hidden" name="projectVersion" value="$projectVersion"/>
XWiki.JavaScriptExtension[0]
Code
... ... @@ -1,25 +1,26 @@
1 1  require(['jquery'], function ($) {
2 - $('#emailForm').on('submit', function () {
3 - var xwikiForm = $(this);
4 - var userEmail = $.trim($("#userEmail", xwikiForm).val());
5 - if (this.checkValidity()) {
6 - // Update and submit the Marketo hidden form.
7 - var marketoForm = $(".marketoForm");
8 - if (marketoForm.length > 0) {
9 - marketoForm = marketoForm[0];
10 - // Update.
11 - $("input[name='Email']", marketoForm).val(userEmail);
12 - // Submit the data.
13 - $(".mktoButton", marketoForm).click();
2 + $('#emailForm').on('submit', function () {
3 + var xwikiForm = $(this);
4 + var userEmail = $.trim($("#userEmail", xwikiForm).val());
5 + if (this.checkValidity()) {
6 + // Update and submit the Webmecanik hidden form.
7 + var webmecanikForm = $(".webmecanik_form form");
8 + if (webmecanikForm.length > 0) {
9 + webmecanikForm = webmecanikForm[0];
10 + // Update.
11 + $("input[name='mauticform[email]']", webmecanikForm).val(userEmail);
12 + // Submit the data.
13 + setTimeout(function(){
14 + $("button[name='mauticform[submit]']", webmecanikForm).click();
15 + }, 500);
16 + }
17 + // Redirect to the download URL.
18 + location.href = "$request.downloadURL";
19 + // Prevent the browser from submitting the form, since we`ve handled it.
20 + return false;
21 + } else {
22 + // Let the browser submit the form and display the validation errors natively.
23 + return true;
14 14   }
15 - // Redirect to the download URL.
16 - console.log("$request.downloadURL");
17 - location.href = "$request.downloadURL";
18 - // Prevent the browser from submitting the form, since we`ve handled it.
19 - return false;
20 - } else {
21 - // Let the browser submit the form and display the validation errors natively.
22 - return true;
23 - }
25 + });
24 24   });
25 -});
Name
... ... @@ -1,1 +1,1 @@
1 -Marketo
1 +Webmecanik

Get Connected