AnsweredAssumed Answered

On click of save it is ignoring confirmation box

Question asked by chetali09 on Nov 13, 2015

I am working on a code where on click of Save button in Account's create view, I need to ask for the confirmation to the user and it is like: If website field is left blank then I am displaying a confirmation box. If user clicks on Cancel then Save shouldn't be allowed and if he clicks on Confirm Save will be allowed

 

({

  extendsFrom : 'CreateActionsView',

 

  initialize: function(options){

  this._super("initialize",[options]);

  this.context.on('button:save_button:click', this.webconfirmation, this);

  },

  webconfirmation: function(){

  var value = this.model.get('website');

  if(value == "" || value == undefined || value == null) {

  app.alert.show('message-id', {

  level: 'confirmation',

  messages: 'Website field is blank. Do you want to proceed?',

  autoClose: false,

  onConfirm: function(){

          this.model.save();

    }

  });

  }

  },

})

 

From the above code, I am getting the alert but before clicking on Cancel or Confirm save is happening on the background.

Outcomes