Skip to content

Commit

Permalink
Pass form to submitMultiPdfForm
Browse files Browse the repository at this point in the history
- Pass form to submitMultiPdfForm to use in FormData creation.
  • Loading branch information
omar-ahmed42 committed Dec 17, 2024
1 parent eb13014 commit 42c238d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/resources/static/js/downloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand All @@ -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.');
Expand Down

0 comments on commit 42c238d

Please sign in to comment.