0

I have my HTML where I'm trying to use Dropzone.js

<form id="loadDropzone" method="post" action="" class="dropzone"></form>

And my JavaScript

 Dropzone.autoDiscover = true;

$("div#loadDropzone").dropzone({//loading dropzone options
    paramName: 'photos',
    url: '#',
    dictDefaultMessage: "Insert your files",
    clickable: true,
    enqueueForUpload: true,
    maxFilesize: 2,
    uploadMultiple: false,
    addRemoveLinks: true,
    init: function(){
        this.on("addedfile", handleFileAdded);
        this.on("removedfile", handleFileRemoved);
        this.on("error", function(file){if (!file.accepted) this.removeFile(file);});
    }
});

My intention is to load a simple dropzone form where I can add files. If I put something in the HTML, the action loads the defaults settings (I can see it like the example on the Dropzone.js website). If I leave the action in form blank (like posted), Dropzone.js is not working.

Any help to load a simple dropzone form?

roberrrt-s
  • 7,914
  • 2
  • 46
  • 57
Fedeco
  • 846
  • 10
  • 28
  • if you have `form action=''`, then you must specify the dropzone's url `url: 'some-page.php',` – andrew Nov 08 '16 at 11:04
  • if form action='#' loads default message ('drag your files here'). I want to show 'Insert your file' as default message. even putting _url:'some-page.php'_ is not working As you can see I'm stuck with a little thing that makes dropzone not loading my custom options – Fedeco Nov 08 '16 at 11:09
  • then your answer lies in dropzone's tip section: http://www.dropzonejs.com/#tips. It states: If you do not want the default message at all (»Drop files to upload (or click)«), you can put an element inside your dropzone element with the class dz-message and dropzone will not create the message for you. Perhaps instead of "empty" you can mess with the inner template and change the text in script – andrew Nov 08 '16 at 11:19
  • never thought about this solution and maybe misread that section.It greatly worked ! The only negative thing is that for an open source library I have to modify the script or put . Thank you for your kind answer – Fedeco Nov 08 '16 at 13:02
  • 1
    actually, there is already an answer here, i SO... http://stackoverflow.com/questions/17702394/how-do-i-change-the-default-text-in-dropzone-js – andrew Nov 09 '16 at 12:07

0 Answers0