This seems to be a common task but I can't find the answer anywhere.
I want to be able to drag and drop files to the site, along with other input form elements. Once submitted, the files are uploaded, then once finished the rest of the form is uploaded.
Dropzone.options.myAwesomeDropzone = {
autoProcessQueue: false,
url: '../upload_invoice_pdf',
previewsContainer: ".dropzone-previews",
uploadMultiple: true,
parallelUploads: 100,
maxFiles: 100,
// The setting up of the dropzone
init: function() {
var myDropzone = this;
// First change the button to actually tell Dropzone to process the queue.
$("input[type=submit]").click(function(e){
e.preventDefault();
myDropzone.processQueue();
});
this.on("successmultiple", function(files, response) {
// Gets triggered when the files have successfully been sent.
// Redirect user or notify of success.
//$("input[type=submit]").unbind("click");
$("form#invoiceForm").submit();//submit();
});
}
}
So that's the code. It's uploading the files ok but when it gets to the success handler I want it to submit the rest of the form. The e.preventDefault() is what's stopping it, but I have tried unbinding, different events, firing twice, everything.
Thanks