Changes for page Download Version

Last modified by Simon Urli on 2023/10/10

<
From version < 9.16 >
edited by Eduard Moraru
on 2016/11/25
To version < 9.17 >
edited by Eduard Moraru
on 2016/11/25
>
Change comment: There is no comment for this version

Summary

Details

XWiki.JavaScriptExtension[0]
Code
... ... @@ -2,16 +2,22 @@
2 2   $('#emailForm').on('submit', function () {
3 3   var xwikiForm = $(this);
4 4   var userEmail = $.trim($("#userEmail", xwikiForm).val());
5 - if (userEmail != '' && this.checkValidity()) {
5 + if (this.checkValidity()) {
6 + // Update and submit the Marketo hidden form.
6 6   var marketoForm = $(".marketoForm");
7 7   if (marketoForm.length > 0) {
8 8   marketoForm = marketoForm[0];
9 - $("input[name='Email']", marketoForm).val($("#userEmail", xwikiForm).val());
10 + // Update.
11 + $("input[name='Email']", marketoForm).val(userEmail);
12 + // Submit the data.
10 10   $(".mktoButton", marketoForm).click();
11 11   }
15 + // Redirect to the download URL.
12 12   location.href = "$request.downloadURL";
17 + // Prevent the browser from submitting the form, since we`ve handled it.
13 13   return false;
14 14   } else {
20 + // Let the browser submit the form and display the validation errors natively.
15 15   return true;
16 16   }
17 17   });

Get Connected