I have a dropzone form to upload files, for which the behaviour of the submit button (id=submit-all) is governed by the following javascript part (in order to upload all files once the button is clicked):
Dropzone.options.myDropzone = {
// Prevents Dropzone from uploading dropped files immediately
autoProcessQueue: false,
uploadMultiple: true,
init: function() {
var submitButton = document.querySelector("#submit-all")
myDropzone = this; // closure
submitButton.addEventListener("click", function() {
myDropzone.processQueue(); // Tell Dropzone to process all queued files.
});
this.on("queuecomplete", function (file) {
if (this.getUploadingFiles().length === 0 && this.getQueuedFiles().length === 0) {
location.href = 'ecrire_aonce.php?final=y';
}
});
}
};
When the button is clicked, all files are uploaded and processed as expected, and then the visitor is redirected to the page 'write.php?final=y' (congrats message). However this script does not work when no file is selected: clicking the button has no effect at all.
Could anyone help me with this issue ? Many thanks in advance for your replies !!
