From 42c238d87d1dccdc1d0e7f2c306122670955a75e Mon Sep 17 00:00:00 2001 From: Omar Ahmed Hassan Date: Wed, 18 Dec 2024 01:28:04 +0200 Subject: [PATCH] Pass form to submitMultiPdfForm - Pass form to submitMultiPdfForm to use in FormData creation. --- src/main/resources/static/js/downloader.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/resources/static/js/downloader.js b/src/main/resources/static/js/downloader.js index 752d459bf37..563195430ac 100644 --- a/src/main/resources/static/js/downloader.js +++ b/src/main/resources/static/js/downloader.js @@ -87,7 +87,7 @@ if (remoteCall === true) { if (override === 'multi' || (!multipleInputsForSingleRequest && files.length > 1 && override !== 'single')) { - await submitMultiPdfForm(url, files); + await submitMultiPdfForm(url, files, this); } else { await handleSingleDownload(url, formData); } @@ -367,7 +367,7 @@ return {filename, blob}; } - async function submitMultiPdfForm(url, files) { + async function submitMultiPdfForm(url, files, form) { const zipThreshold = parseInt(localStorage.getItem('zipThreshold'), 10) || 4; const zipFiles = files.length > zipThreshold; let jszip = null; @@ -390,7 +390,9 @@ // Get existing form data let formData; - if (postForm) { + if (form) { + formData = new FormData(form); + } else if (postForm) { formData = new FormData($(postForm)[0]); // Convert the form to a jQuery object and get the raw DOM element } else { console.log('No form with POST method found.');