mirror of https://git.48k.eu/ogcp
js: fix id update in partition form deletion
Update all the name and id fields of the elements in the partition form after a delete operation. Inconsistent ids make form.validate() to always return False, this causes all the form validation code to be skipped.master
parent
0ba0b933e2
commit
a04ef4e421
|
@ -325,10 +325,12 @@ function RemovePartition(evt) {
|
|||
target.remove();
|
||||
// Reassign rows ids
|
||||
table.find('tr').each(function(index) {
|
||||
$(this).find('.form-control').each(function() {
|
||||
function update_references() {
|
||||
const id = $(this).attr('id').replace(/(.*)-(\d{1,4})-(.*)/, `$1-${index}-$3`);
|
||||
$(this).attr('name', id).attr('id', id);
|
||||
});
|
||||
}
|
||||
$(this).find('input').filter(':first').each(update_references);
|
||||
$(this).find('.form-control').each(update_references);
|
||||
});
|
||||
} else {
|
||||
table.find('tr').each(function(index) {
|
||||
|
|
|
@ -111,7 +111,7 @@
|
|||
<!-- ChartJS -->
|
||||
<script src="{{ url_for('static', filename='AdminLTE/plugins/chart.js/Chart.min.js') }}"></script>
|
||||
|
||||
<script src="{{ url_for('static', filename='js/ogcp.js') }}?v=1"></script>
|
||||
<script src="{{ url_for('static', filename='js/ogcp.js') }}?v=2"></script>
|
||||
|
||||
<script>
|
||||
// error messages
|
||||
|
|
Loading…
Reference in New Issue