Mi spiace per il titolo... pensavo risultasse chiaro.
per il tuo suggerimento...non l'ho tanto capito...
il codice jquery viene eseguito quando la pagina è ready.. il caricamento del file nel box dropzone.. funziona...
è quando clicco submit che non va...
ora ho trovato un altro esempio che tento di usare......
in cui fa....
document.getElementById("testbtn").addEventListene r("click", function(e) {
alert('ok');
// Make sure that the form isn't actually being sent.
e.preventDefault();
e.stopPropagation();
myDropzone.processQueue();
e sembra andare meglio... se riesco a finirlo.. poi posto il codice, così magari è utile ad altri
codice:
<form id="form_addfile" name="form_addfile" class="form-horizontal" action="#" method="post" enctype="multipart/form-data">
<div id="dropzone-panda" class="dropzone" style="height:200px; border:1px solid #000000;"></div> <!-- This is the dropzone element -->
<div class="form-group">
<label class="control-label col-md-3">Titolo File</label>
<div class="col-md-9">
<input type="Titolo" class="form-control" id="titolo" name="titolo" placeholder="Titolo">
</div>
</div>
<div class="form-group text-center">
<div class="col-md-6 col-md-offset-3">
<button type="submit" class="btn btn-info">salva</button>
</div>
</div>
</form>
codice:
$(document).ready(function() {
Dropzone.autoDiscover = false;
var myDropzonePanda = new Dropzone("div#dropzone-panda", {
url: "/backend/schede/ajax/ajax_file.php",
addRemoveLinks: true,
// The configuration we've talked about above
autoProcessQueue: false,
uploadMultiple: true,
parallelUploads: 100,
maxFiles: 100,
// The setting up of the dropzone
init: function() {
var myDropzone = this;
var form = document.forms[0];
// First change the button to actually tell Dropzone to process the queue.
form.querySelector("button[type=submit]").addEventListener("click", function(e) {
alert('ok');
// Make sure that the form isn't actually being sent.
e.preventDefault();
e.stopPropagation();
myDropzone.processQueue();
});
// Listen to the sendingmultiple event. In this case, it's the sendingmultiple event instead
// of the sending event because uploadMultiple is set to true.
this.on("sendingmultiple", function() {
// Gets triggered when the form is actually being sent.
// Hide the success button or the complete form.
});
this.on("successmultiple", function(files, response) {
// Gets triggered when the files have successfully been sent.
// Redirect user or notify of success.
});
this.on("errormultiple", function(files, response) {
// Gets triggered when there was an error sending the files.
// Maybe show form again, and notify user of error
});
}
});
});