File Upload (Dropzone) removedfile event not triggered

Confluence User - 15 Aug, 2018

Hi,

In form builder, I'm trying to display some information (content) of the uploaded file in custom HTML.

I have been able to catch the "addedfile" and "success" event and display di file information. However I'm unable to get the "removedfile" event to clear the file information if user remove it from the form.

Below is the code I'm working on, the add and success message box is triggered when file added, but remove event is never triggered. Please advice how to catch the event.

 

<script>
    var fName = "#" + $("#mpfMain_1_demoData_fileUpload").closest("div").attr("id");

    $(function() {
        var myDropzone = Dropzone.forElement(fName);
        
        myDropzone.addRemoveLinks = true;
        
        myDropzone.on("removedfile", function(file){
            alert('remove triggered');
        });
        
        myDropzone.on("addedfile", function(file){
            alert('add triggered');
        });
        
        myDropzone.on("success", function(file){
            alert('success triggered');
        });        

    });
</script>
forms;fileupload;dropzone

2


18 Aug, 2018
confluenceUser
confluenceUser

Hi, I am not familiar with dropzone perhaps you could try searching or asking in stackoverflow for better answers for example https://stackoverflow.com/questions/43434283/dropzone-js-events-not-firing

20 Aug, 2018
confluenceUser
1
confluenceUser

Hi Anders, thanks for the response. Not sure but it seems that Joget form element is not implementing the standard dropzone remove function. After checking the fileupload.js I find out remove event can be handled using below code. 

$(fName).on("click", ".remove", function(){ alert('remove triggered'); });
RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print