I fixed this issue by always maintaining an empty hidden form (with an empty Dropzone), and simply cloning it each time I needed it, while making sure I kept assigning a unique id
and name
to each cloned form.
resetAllFields in cloned Dropzone.js
-
07-07-2023 - |
Question
I have a form with a bunch of input elements and a Dropzone element. Now, I let the user duplicate the form (via deep clone
) - each form is submitted independently via AJAX POST.
When the user clones the form, I clear all the input field values using -
cloned_form.find('textarea, input').val('');
Now, I'd also like to clear the Dropzone element, which I'm trying to do like this -
cloned_form.find('form#my-awesome-dropzone').dropzone.resetAllFields();
This throws the "... is not a function" error. How do I actually reset the Dropzone element?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow