Add dropzone as a field in the form.
<!--...other fields-->
<div id="my-dropzone" class="dropzone"></div>
<input type="submit" id="submit" value="Submit">
write the following code while defining dropzone in javascript
init: function () {
var dz = this;
$btn.click(function (e) {
//prevents the form from submitting
e.preventDefault();
//tell dropzone to process the form
dz.processQueue();
});
this.on('sending', function (file, xhr, formData) {
let data = {};
// Append form fields to the foemData object that the dropzone sends to server
$.each($form.serializeArray(), function (key, el) {
data[el.name] = el.value;
formData.append(el.name,el.value);
});
formData.append('content',getEditorContent());
//or append data to formData object manually
//e.g. just fetch whatever data you want using selector and append it to formData object
});
},