1

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

1 Answer 1

1

DONE IT!!!!

Apparently you cant have the name "submit" for the submit button, WHAT THE FRACK!

Sign up to request clarification or add additional context in comments.

2 Comments

you change input type from submit to button?
No, just the name of the button. is now <input type="submit" name="submitIT"> name used to be submit but that was the problem

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.