mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fixes for double-submit on butons
- Function that first unbinds the submit button
This commit is contained in:
parent
bf4ffb8b0b
commit
fdf35bd741
@ -65,6 +65,15 @@ function closeModal(modal='#modal-form') {
|
|||||||
$(modal).modal('hide');
|
$(modal).modal('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function modalSubmit(modal, callback) {
|
||||||
|
$(modal).off('click', '#modal-form-submit');
|
||||||
|
|
||||||
|
$(modal).on('click', '#modal-form-submit', function() {
|
||||||
|
callback();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function openModal(options) {
|
function openModal(options) {
|
||||||
|
|
||||||
var modal = options.modal || '#modal-form';
|
var modal = options.modal || '#modal-form';
|
||||||
@ -188,10 +197,7 @@ function handleModalForm(url, options) {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Un-bind any attached click listeners
|
modalSubmit(modal, function() {
|
||||||
$(modal).off('click', '#modal-form-submit');
|
|
||||||
|
|
||||||
$(modal).on('click', '#modal-form-submit', function() {
|
|
||||||
$(modal).find('.js-modal-form').ajaxSubmit({
|
$(modal).find('.js-modal-form').ajaxSubmit({
|
||||||
url: url,
|
url: url,
|
||||||
// POST was successful
|
// POST was successful
|
||||||
|
@ -102,7 +102,7 @@ function updateStock(items, options={}) {
|
|||||||
content: html
|
content: html
|
||||||
});
|
});
|
||||||
|
|
||||||
$(modal).on('click', '#modal-form-submit', function() {
|
modalSubmit(modal, function() {
|
||||||
|
|
||||||
var stocktake = [];
|
var stocktake = [];
|
||||||
|
|
||||||
@ -244,7 +244,7 @@ function moveStockItems(items, options) {
|
|||||||
modalSetContent(modal, html);
|
modalSetContent(modal, html);
|
||||||
attachSelect(modal);
|
attachSelect(modal);
|
||||||
|
|
||||||
$(modal).on('click', '#modal-form-submit', function() {
|
modalSubmit(modal, function() {
|
||||||
var locId = $(modal).find("#stock-location").val();
|
var locId = $(modal).find("#stock-location").val();
|
||||||
|
|
||||||
doMove(locId, parts);
|
doMove(locId, parts);
|
||||||
|
Loading…
Reference in New Issue
Block a user