I am using Zend Framework 2 and have implemented Dropzone.js. I am still very new to Dropzone and am now facing the following problem. I submit my file along with the rest of the form fields. With PHP, I check if the form is valid if I do not return error messages and attach it via jQuery to the form. Everything works fine, but, unfortunately, after I filled out all the form fields, I can no longer click the submit button. How can i achieve this? It just sounds like a normal process, but I have to do something very wrong. Can someone give me a hint?
Dropzone.options.myDropzone = {
autoProcessQueue: false,
uploadMultiple: true,
parallelUploads: 100,
maxFiles: 1,
maxFilesize: 10,
acceptedFiles: 'image/*',
addRemoveLinks: true,
autoDiscover: false,
previewsContainer: '.dropzone-previews',
clickable: '.dz-clickable',
accept: function(file, done) {
console.log("uploaded");
done();
},
init: function() {
var myDropzone = this;
$('#myDropzone').on("submit", function(e) {
if(myDropzone.files.length > 0) {
e.preventDefault();
e.stopPropagation();
myDropzone.processQueue();
}
});
myDropzone.processQueue();
this.on("maxfilesexceeded", function(file){
alert("You have exceeded the maximum files allowed !");
this.removeFile(file);
});
this.on("sendingmultiple", function() {
});
this.on("successmultiple", function(files, response) {
if (response.status == true)
{
window.location.replace(response.redirect);
}else{
$.each(response.error, function(key, value){
$('[name="'+key+'"]').parent().append(getErrorHtml(response[key], value));
});
}
});
this.on("errormultiple", function(files, response) {
});
},
};
function getErrorHtml(key , value)
{
var html = '<ul id="errors-'+key+'" class="errors">';
html += '<li>' + value + '</li>';
html += '</ul>';
return html;
}
source
share