IfnotFr / PopConfirm

A simple action confirmation plugin for jQuery based on Twitter Bootstrap Popover

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow specifying of handlers for onConfirmation.

ivanoronee opened this issue · comments

It would be nice to allow specifying of handlers for onConfirm.
Case in point, i would like to proceed with executing some javascript if the user allows the operation to continue.

I cannot currently do this because all the onclick events associated with the object are removed by the plugin.

What would be cool would be providing a mechanism for providing handlers for onConfirm.

Interesting behaviour proposal.

Guys, please +1 this feature if you are interested.

Hi there... I currently have this:

<a  class="trash-key"
  href="#"
  data-post-url="...some url ... "
  data-confirm-title="Are you sure?"
  data-confirm-content="About to delete key <strong>{{$key}}</strong> from database."
  data-confirm-placement="top"
  data-confirm-container="body"
  data-confirm-yesBtn="Ok, delete!"
  data-confirm-noBtn="No"
  > <i class="fa fa-trash fa-lg" aria-hidden="true"></i>
</a>
$('a.trash-key').click(function (e){
  var row = $(this).closest('tr');
  var url = $(this).data('post-url');
  var id = row.attr('id');
  $.post( url, {id: id}, function(){
    row.remove();
    } );
    return false;
});

$("a.trash-key").popConfirm();

The javascript is executed ONLY if I click the yesBtn.

@RamonZayas this behaviour is normal, this it the main goal of the plugin : to queue an action of a button and execute it with a confirmation on the YES button.

I know, but that is exactly what @ivanoronee is asking for... am I right?... or is this something completely different? what am I missing?.

I thinks it is different.

Can you explain your case with more precision ?

Isn't this solved with #33?

Maybe it's just a matter of documentation. It isn´t clear that when you click the 'Yes' button, the original click handler is called

This plugin is an "Simple action confirmation plugin".

So, it ask a confirmation before doing an action, and do the action only if we click yes.

@EnekoGB : do you think the "action confirmation" is too ambigous ? Should i add a example ? (like a confirm() in javascript ?)

@ifnot When i read the doc the first time, it wasn't clear to me, maybe because i had used @tavicu bs-confirmation, which has an onConfirm callback.

I realized how this plugin works only when I checked the fiddle demo.

Maybe a little change in README.md like #34 whould make it clearer.

I have merged the example.

I need some docs update as the action can be manual.

I will work on it when i have the time :)