From ef951cbb917fdb69790a86c47dd8d1f7a31f8e67 Mon Sep 17 00:00:00 2001 From: candifloss Date: Mon, 10 Feb 2025 13:37:36 +0530 Subject: [PATCH] Fixed csv submission javascript --- static/edited_csv.js | 7 +++++-- templates/csv_preview.html | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/static/edited_csv.js b/static/edited_csv.js index b3b7177..afa2a35 100644 --- a/static/edited_csv.js +++ b/static/edited_csv.js @@ -1,5 +1,5 @@ -function collectEditedData() { - const rows = document.querySelectorAll('tbody tr'); +function collectEditedData(event) { + const rows = document.querySelectorAll('.table-new-assets tbody tr'); const assets = []; rows.forEach(row => { @@ -19,4 +19,7 @@ function collectEditedData() { input.name = 'assets'; input.value = JSON.stringify(assets); document.querySelector('form').appendChild(input); + + event.target.submit(); // Submit the form after attaching data + return true; } \ No newline at end of file diff --git a/templates/csv_preview.html b/templates/csv_preview.html index b146a60..011eb4a 100644 --- a/templates/csv_preview.html +++ b/templates/csv_preview.html @@ -12,7 +12,7 @@ {% if new_assets %}

New assets:

- +
{% for attrib, config in item_attributes.items() %} @@ -34,7 +34,7 @@ {% if existing %}

These assets are already in the database:

-
+
{% for attrib, config in item_attributes.items() %}