user3795286
user3795286

Reputation: 138

Meteor prevent browser default alert upon submit

I have a specific unified alert package that displays alerts/notifications upon submission in a cohesive way across web browsers. I am finding that after submit in the Autoform.hook(), the default browser alert format also fires. Any help to prevent the default browser alter from firing would be appreciated. enter image description here

I have tried using an event handler:event.preventDefault();

AutoForm.hooks({
  'edit-form': {
    onSuccess: function (operation, result, template) {
      IonPopup.alert({
    title: 'Saved Succesfully!',
    subTitle: 'Please Click OK to go back',
    onOk: function()
        {
          Session.set("editingReqEvent", null);
          Router.go('calendar');
        }
  });
},

onError: function(operation, error, template) {
  IonPopup.alert({title: 'Save Unsucessful!', subTitle: 'Please go back and check entries'});
  console.log(error);
   }
  }
});

Upvotes: 2

Views: 153

Answers (1)

bpoiss
bpoiss

Reputation: 14023

You can disable the default alert event, or overwrite it just with plain js:

window.alert = function() {};

Upvotes: 1

Related Questions