Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author lynton_reed

    (@lynton_reed)

    Hi jinch,

    if you are familiar with javascript / html then you could add your own js handler to check “are you are sure” on a delete button click event.

    You can look in the php file that generates the html in :

    wp-content\plugins\work-the-flow-file-upload\public\includes\wtf-fu-templates.php

    look for
    <button class=”btn btn-danger delete” ….

    Off the top of my head, I can suggest two possible approaches :

    1) Add your own js to your theme to add an onClick handler for the delete button class

    2) Modify the wtf-fu-templates. php to add in an inline onClick handler.

    1) is much better as 2) will need to be reapplied after future plugin updates.

    If you try it please let me know how you got on.

    Thread Starter jinch

    (@jinch)

    Thanks Lynton –

    Unfortunately I’m no programmer!

    I found and adapted some Jquery and put it in a child theme js file:

    $('button.btn.btn-danger.delete').on('click',function(e){
        var answer=confirm('Do you want to delete?');
        if(answer){
         alert('Deleted');
        }
        else{
         e.preventDefault();
        }
    });

    This seems to work on the Delete button that sits at the top of the workflow (along with all the other buttons) but on the list of already uploaded files where each has its own Delete button next to it, then these Delete buttons aren’t affected by the above code and just go ahead and delete the file without prompting me to confirm.

    The buttons all seem to use the same classes but I don’t know why all but the top one ignore the confirmation code?

    p.s I’m using a simple workflow using just [wtf_fu_upload]

    Thread Starter jinch

    (@jinch)

    Actually the top one doesn’t work either if I tick a file first.

    Thread Starter jinch

    (@jinch)

    Lyndon, is a JavaScript solution possible for this? It looks like there’s Ajax involved in the button action and online comments suggest that the Ajax is actions before JavaScript would stop it?

    There looks to be ways to add stops in Ajax or even an Ajax confirmation pop up but I don’t know if that be be added to a child theme?

    Thread Starter jinch

    (@jinch)

    Sorry bad typing. Should say “actioned before” and “if that can be added”

    Plugin Author lynton_reed

    (@lynton_reed)

    Maybe i spoke too quickly then. I have not investigated this, this is just where I would start looking. Let me know if you can get it to work.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Delete 'are you sure?' message?’ is closed to new replies.