Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't resubmit if autoProcessQueue is false and ajax request has failed #617

Closed
G33kLabs opened this issue Jun 12, 2014 · 9 comments
Closed

Comments

@G33kLabs
Copy link

Hi !

Actually, I use dropzone like the tutorial in wiki's pages : https://github.com/enyo/dropzone/wiki/Combine-normal-form-with-Dropzone

With that method, form inputs and attachment are uploaded in one POST multipart request, so great !
But the problem with that method is when server's validation failed, reclicking on submit doesn't post again the form.

This is because on error, file.status is not updated to Dropzone.QUEUED.

So I fix that with this code :

view.dropzone = new Dropzone(form[0], {
    ...
    autoProcessQueue: false,
    uploadMultiple: false,
    parallelUploads: 100,
    maxFiles: 1,
    thumbnailWidth: 300,
    thumbnailHeight: null,
    previewsContainer: inputPreview[0],
    clickable: inputClick[0],
    acceptedFiles: 'image/*',
    ...
    error: function(file, errorMessage, xhr) {

        // Trigger an error on submit
        view.onSubmitComplete({
            file: file,
            xhr: xhr
        });

        // Allow file to be reuploaded !
        file.status = Dropzone.QUEUED;
        // this.cancelUpload(file);
        // this.disable();
        // this.uploadFile(file);

    }
});
@jacek213
Copy link

thanks, saved me a lot of digging :)

@mada41
Copy link

mada41 commented Apr 19, 2015

many thanks guys! , you save my night 👍

@mahe020
Copy link

mahe020 commented Sep 4, 2015

Lot Thanks buddy.....

@martin-brennan-csnet
Copy link

Thanks so much!

@hardy2defy
Copy link

thank you

@jogeshpi03
Copy link

thank works great. 👍

@tklaas
Copy link

tklaas commented Sep 13, 2018

Thanks for saving me hours for that 👍

@mreduar
Copy link

mreduar commented Jul 24, 2019

This doesn't work for me when the server has an error 500. Does anyone know why?

@fferoz
Copy link

fferoz commented Jan 7, 2020

I was facing the same issue and get resolved by using the fix file.status = Dropzone.QUEUED;
Thanks @G33kLabs

@enyo enyo closed this as completed Feb 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests