Support

Account

Home Forums Add-ons Flexible Content Field Confirm delete on flexible content field row

Solved

Confirm delete on flexible content field row

  • It would be nice if there was an “Are you sure?” confirm message when you click the X or delete icon on a flexible content field row. Can you recommend a way to implement this?

  • Hi @jason@epagecity.com

    You can easily add this via some custom jQuery on the page.

    Just add an .on('click') event to the elements (via their class) and the use the confirm JS function to make a prompt.

    I’ll think about adding this to the core, but for now, a custom script will be the fastest way to see this implemented.

    Thanks
    E

  • Thanks Elliot. How do you queue up a jquery script to only run on pages that have the flexible content fields?

  • Hi @jason@epagecity.com

    You can use this action to enqueue scripts/styles for a page which displays custom fields – http://www.advancedcustomfields.com/resources/actions/acfinputadmin_enqueue_scripts/

  • Hi,

    i tried something like that

    var $ = jQuery;

    $(document).on('click', '.acf-flexible-content .acf-fc-remove',  function(e)
    {
    	
    if(confirm("you are about to delet an element!")){
    						
    				}else{
    					 e.stopImmediatePropagation();
                                   return false
    					}		
    
    });

    but the click event of the field is still triggered and the row gets deleted.

    any hints on that?

  • +1 on baking this into a future release!

  • I’d like to see this baked in, too. Or maybe as an option when creating the flexible content field.

    I had the same results as l.pirondini, but I admittedly didn’t spend more time trying to figure it out.

  • Hi everyone!
    Thanks Elliot for the tip, but from a user’s point of view that functionality should be native.
    You should always prevent users to delete content by accident.
    All our clients are complaining about this. They just don’t understand, especially the fact that the delete button is so close from the toggle button.

    Do you plan to ship this functionality soon?

    Anyway, thank you very much for your great, essential work.

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Confirm delete on flexible content field row’ is closed to new replies.