Fixed csv submission javascript
This commit is contained in:
parent
59526aee24
commit
ef951cbb91
@ -1,5 +1,5 @@
|
|||||||
function collectEditedData() {
|
function collectEditedData(event) {
|
||||||
const rows = document.querySelectorAll('tbody tr');
|
const rows = document.querySelectorAll('.table-new-assets tbody tr');
|
||||||
const assets = [];
|
const assets = [];
|
||||||
|
|
||||||
rows.forEach(row => {
|
rows.forEach(row => {
|
||||||
@ -19,4 +19,7 @@ function collectEditedData() {
|
|||||||
input.name = 'assets';
|
input.name = 'assets';
|
||||||
input.value = JSON.stringify(assets);
|
input.value = JSON.stringify(assets);
|
||||||
document.querySelector('form').appendChild(input);
|
document.querySelector('form').appendChild(input);
|
||||||
|
|
||||||
|
event.target.submit(); // Submit the form after attaching data
|
||||||
|
return true;
|
||||||
}
|
}
|
@ -12,7 +12,7 @@
|
|||||||
<!-- Display CSV data in a table -->
|
<!-- Display CSV data in a table -->
|
||||||
{% if new_assets %}
|
{% if new_assets %}
|
||||||
<p>New assets:</p>
|
<p>New assets:</p>
|
||||||
<table border="1">
|
<table border="1" class="table-new-assets">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
{% for attrib, config in item_attributes.items() %}
|
{% for attrib, config in item_attributes.items() %}
|
||||||
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
{% if existing %}
|
{% if existing %}
|
||||||
<p>These assets are already in the database:</p>
|
<p>These assets are already in the database:</p>
|
||||||
<table border="1">
|
<table border="1" class="table-existing-assets">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
{% for attrib, config in item_attributes.items() %}
|
{% for attrib, config in item_attributes.items() %}
|
||||||
|
Loading…
Reference in New Issue
Block a user