ferk86
ferk86

Reputation: 2345

How to stop page from refreshing after confirmation box?

I have this code inside a a method that forms a menu in Ext:

  handler: function() {
     var r = $wnd.confirm("Are you sure?");
  }

When I use $wnd.alert, it just shows a popup. When replaced with confirm, it works but then causes the whole page to refresh after a selection. Ideally, I'd like to use $wnd.Ext.MessageBox.confirm, but when I use that, I get the error cb.defer is not a function. Figuring out how to get the Javascript confirm to work will be much appreciated.

Upvotes: 0

Views: 532

Answers (1)

EricG
EricG

Reputation: 3849

I would suggest one (or a combination) of these options:

event.cancelBubble = true;
event.stopPropagation();
return false;

Upvotes: 1

Related Questions