dropzone
dropzone copied to clipboard
Form submission on empty queue
There should be a feature or another way to submit a normal form w/ dropzone in case the user doesn't want to upload files.
Could you explain better your question? I mean... are you trying to send all the data through only one form? If so you could test before submitting it, like this:
init: function() {
var myDropzone = this;
$("#myAwesomeForm").on("submit", function(e) {
if(myDropzone.files.length > 0) {
e.preventDefault();
e.stopPropagation();
myDropzone.processQueue();
}
});
// some more code...
}
I need this feature too. I have form with "comment" and "files". Files can be empty, but i can't send form by dropzone without files.
I try
document.querySelector("#description-form-submit").addEventListener('click', function () {
if (descriptionForm.getQueuedFiles().length > 0) {
descriptionForm.processQueue();
} else {
descriptionForm.uploadFiles([]);
}
});
But i have error on this line
formData.append(this._getParamName(i), files[i], files[i].name);
because files empty.
So, can you add possibility to send form only with inputs?
For example add method: sendForm() - which send form without file checks.