Fix multi submit bug with direct upload

This commit is contained in:
Paul Chavard 2018-02-15 18:38:58 +01:00
parent 389760fc17
commit 35a4367114
5 changed files with 45 additions and 10 deletions

View file

@ -42,4 +42,16 @@ addEventListener("direct-upload:end", function (event) {
element = document.getElementById("direct-upload-" + id);
element.classList.add("direct-upload--complete");
});
});
addEventListener('load', function() {
var submitButtons = document.querySelectorAll('form button[type=submit][data-action]');
var hiddenInput = document.querySelector('form input[type=hidden][name=submit_action]');
submitButtons = [].slice.call(submitButtons);
submitButtons.forEach(function(button) {
button.addEventListener('click', function() {
hiddenInput.value = button.getAttribute('data-action');
});
});
});