dropzone icon indicating copy to clipboard operation
dropzone copied to clipboard

Form submission on empty queue

Open kdomingo opened this issue 12 years ago • 2 comments

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.

kdomingo avatar Mar 06 '14 08:03 kdomingo

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...

}

amandasantanati avatar May 16 '14 17:05 amandasantanati

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.

madmis avatar Feb 02 '15 08:02 madmis