Changes for page Download Version

Last modified by Simon Urli on 2023/10/10

From version 12.1
edited by Paul Panțiru
on 2021/01/11
Change comment: Rollback to version 10.1
To version 14.1
edited by Paul Panțiru
on 2021/01/11
Change comment: Rollback to version 9.18

Summary

Details

Page properties
Content
... ... @@ -15,9 +15,16 @@
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 - <div class='webmecanik_form' style='display:none;'>
19 - <script type="text/javascript" src="//news.xwiki.com/form/generate.js?id=19"></script>
20 - </div>
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>
21 21   <form id="emailForm" action="" class="xform">
22 22   <input type="hidden" name="downloadURL" value="$downloadURL"/>
23 23   <input type="hidden" name="projectVersion" value="$projectVersion"/>
XWiki.JavaScriptExtension[0]
Code
... ... @@ -1,26 +1,24 @@
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 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;
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();
24 24   }
25 - });
15 + // Redirect to the download URL.
16 + location.href = "$request.downloadURL";
17 + // Prevent the browser from submitting the form, since we`ve handled it.
18 + return false;
19 + } else {
20 + // Let the browser submit the form and display the validation errors natively.
21 + return true;
22 + }
26 26   });
24 +});
Name
... ... @@ -1,1 +1,1 @@
1 -Webmecanik
1 +Marketo
XWiki.JavaScriptExtension[1]
Code
XWiki.StyleSheetExtension[1]
Code

Get Connected