javascript - Submit dropzone form from another form? -
i have 2 forms on page, 1 users can upload images , other can rename files. first 1 looks this
{{ form::open(array('url' => request::url(), 'class'=>'dropzone', 'id' =>"my-awesome-dropzone", 'method' => 'post', 'files' => true)) }} {{ form::close()}} and second
{{ form::open(array('url' => request::url())) }} {{ form::text('name', null, array('id' => 'name', 'placeholder' => 'name')) }} {{ form::submit('upload', array('name' => 'upload-file')) }} is possible use submit upload files other form?
{{ form::close() }} this js. got no errors php nor js/jquery, files not uploading , don't know errors or i'm doing wrong. there way? appreciated.
$(function() { dropzone.options.myawesomedropzone = { // camelized version of id of form element thumbnailwidth: 150, thumbnailheight: 150, autoprocessqueue: false, uploadmultiple: true, paralleluploads: 100, maxfiles: 10, // setting of dropzone init: function() { var mydropzone = this; // first change button tell dropzone process queue. document.queryselector("input[name=upload-file]").addeventlistener("click", function(e) { // make sure form isn't being sent. e.preventdefault(); e.stoppropagation(); mydropzone.processqueue(); }); this.on("addedfile", function(file) { $( "#form-width" ).show( "slow" ); $( "#form-rename" ).show( "slow" );}); // listen sendingmultiple event. in case, it's sendingmultiple event instead // of sending event because uploadmultiple set true. this.on("sendingmultiple", function() { // gets triggered when form being sent. // hide success button or complete form. }); this.on("successmultiple", function(files, response) { // gets triggered when files have been sent. // redirect user or notify of success. }); this.on("errormultiple", function(files, response) { // gets triggered when there error sending files. // maybe show form again, , notify user of error }); } }; });
Comments
Post a Comment