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');
|
||||
}
|
||||
|
||||
function modalSubmit(modal, callback) {
|
||||
$(modal).off('click', '#modal-form-submit');
|
||||
|
||||
$(modal).on('click', '#modal-form-submit', function() {
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function openModal(options) {
|
||||
|
||||
var modal = options.modal || '#modal-form';
|
||||
@ -188,10 +197,7 @@ function handleModalForm(url, options) {
|
||||
return false;
|
||||
});
|
||||
|
||||
// Un-bind any attached click listeners
|
||||
$(modal).off('click', '#modal-form-submit');
|
||||
|
||||
$(modal).on('click', '#modal-form-submit', function() {
|
||||
modalSubmit(modal, function() {
|
||||
$(modal).find('.js-modal-form').ajaxSubmit({
|
||||
url: url,
|
||||
// POST was successful
|
||||
|
@ -102,7 +102,7 @@ function updateStock(items, options={}) {
|
||||
content: html
|
||||
});
|
||||
|
||||
$(modal).on('click', '#modal-form-submit', function() {
|
||||
modalSubmit(modal, function() {
|
||||
|
||||
var stocktake = [];
|
||||
|
||||
@ -244,7 +244,7 @@ function moveStockItems(items, options) {
|
||||
modalSetContent(modal, html);
|
||||
attachSelect(modal);
|
||||
|
||||
$(modal).on('click', '#modal-form-submit', function() {
|
||||
modalSubmit(modal, function() {
|
||||
var locId = $(modal).find("#stock-location").val();
|
||||
|
||||
doMove(locId, parts);
|
||||
|
Loading…
Reference in New Issue
Block a user