javascript - Can't get all form data -
i looked everywhere on internet. still stuck ... here's i'm stuck : did form looks :
a multipart form, 2 inputs : data & selectable item.
the problem : i'm lost dropzone, because know i've declare programmatically (because it's part of form). file data , not select option. (java servlet good, after researchs, problem in .jsp / .js files).
here's .jsp :
<form action="upload" id="myform" method="post" enctype="multipart/form-data"> <div id="mydz" class="dropzone dz-clickable hvr-outline-out" style="margin-bottom: 5px;"> <div class="fallback"> <input name="datafile" type="file" /> </div> </div> <div id="procedure"> procédure : <select name="procedure"> <option value="1">toulouse</option> <option value="2">tournefeuille</option> <option value="3">cine 6</option> <option value="4">cinéland</option> </select> <input type="submit" id="sbmtbtn" value="envoyer" /> </div> <script type="text/javascript" src="views/js/createdropzone.js"></script> </form>
and here's .js called after creating form fields :
dropzone.autodiscover = false; var mydropzone = new dropzone("#mydz", { url : 'upload',// action à appeler /* options */ acceptedfiles: ".pdf", // seulement les pdfs. addremovelinks : true, autoprocessqueue : false, // important dont want form submitted unless have clicked submit button uploadmultiple: false, paralleluploads: 1, maxfiles: 1, autodiscover : false, paramname : 'datafile', // similar giving name input type file <input type="file" name="pic" /> clickable : true, // tells dropzone not clickable . have because v dont want whole form clickable accept : function(file, done) { console.log("ajouté"); done(); }, error : function(file, msg) { alert(msg); }, init : function() { //ajout possible de seulement 1 fichier this.on("addedfile", function() { if (this.files[1]!=null){ this.removefile(this.files[0]); } }); //envoi du fichier document.getelementbyid("sbmtbtn").onclick = function(e) { e.preventdefault(); //this prevent default behaviour of submit button because want dropzone submit form mydropzone.processqueue(); // submit form specified action directs jsp upload code // after this, whole form submitted inputs + files , jsp code remain usual //remember don't have call ajax or submit inputs, dropzone take care of }; } // init end });
and, did datas servlet : https://stackoverflow.com/a/13321215/4944071
i need new pov, if can ...
Comments
Post a Comment