简体   繁体   English

Dropzone-如何使div到dropzone(非窗体)和autoProcessQueue:false

[英]Dropzone - How to make div to dropzone (not form) and autoProcessQueue:false

I'm searching the method to make div into dropzone, because I want the dropzone stay inside other html form. 我正在搜索使div进入dropzone的方法,因为我希望dropzone保留在其他html表单内。

so I found the jquery method 所以我找到了jquery方法

<script>
Dropzone.autoDiscover = false;
    jQuery(document).ready(function() {

      $("#mydropzone").dropzone({
        url: "path/to/file",
        autoProcessQueue: false
      });

    });

    $(document).on('click', '#btn_special', function () {
    // enable auto process queue after uploading started
    Dropzone.options.autoProcessQueue = true;
    // queue processing
    Dropzone.processQueue();  ///////////// it's not work ///////
    });

</script>

<form action="some_page.php" method="post">
<table>
    <tr>
        <td>Member Name</td>
        <td><input type="text" name="member_name" /> </td>
    </tr>

</table>

    <div class="dropzone dropzone-previews" id="mydropzone"> <!-- My dropzone stay at this --></div>

    <button type="button" id="btn_special">Upload</button>
    <input type="submit" name="submit_htmlform" value="submit" />
</form>

.. The Problem is I don't know the jquery method to make dropzone submit( Dropzone.processQueue(); ) I know only javascript method. ..问题是我不知道使dropzone提交的jquery方法(Dropzone.processQueue();)我只知道javascript方法。 but also I don't know javascript method to convert the div element to dropzone. 但我也不知道将div元素转换为dropzone的javascript方法。 How should I do? 我应该怎么做?

Try to change your js like this : 尝试像这样更改您的js:

jQuery(document).ready(function() {
   var myDropZone = $("#mydropzone").dropzone({
     url: "path/to/file",
     autoProcessQueue: false,
   });
   $(document).on('click', '#btn_special', function () {
        myDropZone.options.autoProcessQueue = true;
        myDropZone.processQueue();
   });
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM