Add simple flag to prevent multiple submits for Order Form AJAX

This commit is contained in:
Lance Edgar 2017-04-18 18:43:14 -05:00
parent 589a747662
commit ee2137e1bf

View file

@ -7,6 +7,9 @@
${parent.extra_javascript()}
${h.javascript_link(request.static_url('tailbone:static/js/numeric.js'))}
<script type="text/javascript">
var submitting = false;
$(function() {
$('.order-form td.current-order input').keydown(function(event) {
@ -14,6 +17,8 @@
return true;
}
if (event.which == 13) {
if (! submitting) {
submitting = true;
var row = $(this).parents('tr:first');
var form = $('#item-update-form');
form.find('[name="product_uuid"]').val(row.data('uuid'));
@ -28,8 +33,10 @@
row.find('td.po-total').html(data.row_po_total);
$('.po-total .field').html(data.batch_po_total);
}
submitting = false;
});
}
}
return false;
});