我有一个在 Spring 中构建的应用程序。在 JSP 中,我集成了 Dropzone 用于图像上传。
<form:form modelAttribute="services" method="POST" id="service" enctype="multipart/form-data" cssClass="dropzone">
<form:input path="budget">
<form:textarea path="informationToBuyer" cssClass="summernote"/>
<div id="dropzone" class="col-md-8"></div>
<form:form>
在上面的代码中,预算与 spring modelAttribute 绑定并且 informationToBuyer 没有绑定。
但是当我删除summernote css时,它就会被绑定。
我的 Dropzone 的 JS 如下。
Dropzone.options.service = {
// The configuration we've talked about above
autoProcessQueue : false,
uploadMultiple : true,
maxFilesize : 256,
parallelUploads : 50,
maxFiles : 50,
addRemoveLinks : true,
clickable : true,
previewsContainer : "#dropzone",
// The setting up of the dropzone
init : function() {
var myDropzone = this;
// First change the button to actually tell Dropzone to process the queue.
this.element.querySelector("button[type=submit]")
.addEventListener("click", function(e) {
// Make sure that the form isn't actually being sent.
e.preventDefault();
e.stopPropagation();
myDropzone.processQueue();
});
// Listen to the sendingmultiple event. In this case, it's the sendingmultiple event instead
// of the sending event because uploadMultiple is set to true.
this.on("sendingmultiple", function() {
// Gets triggered when the form is actually being sent.
// Hide the success button or the complete form.
myDropzone.processQueue();
});
this.on("successmultiple", function(files, response) {
window.location.replace(response.redirect);
exit();
});
this.on("errormultiple", function(files, response) {
});
}
};
请告诉我为什么所见即所得编辑器不使用 Dropzone 表单。