Confirm dialog is dismissing my popup. How do I prevent that?


#1

I’m initializing my popup like so:

  var timeoffoptionpanel = $('#timeoffoptionpanel').mobiscroll().popup({
          display: 'top',
          scrollLock: false,
          buttons: ['ok','cancel'],
          okText: 'Save',
          onSet: function (event, inst) {submitRequest()}
      }).mobiscroll('getInst')

And then I’m initializing my confirm dialogue like so:

  mobiscroll.confirm({
    title: title,
    message: question,
    okText: ok,
    cancelText: cancel,
    callback: function (confirmed) {
      if(confirmed){
        callback(params);
      }
    }
  });

Note that the “submitRequest” function (called onSet of the popup) calls the confirm.

Both work, but the problem is that when the confirm dialogue opens, it immediately dismisses the popup underneath it. I want that popup to stay put in case the user cancels the confirm. How can I accomplish this?


#2

Never mind. I answered my own question. Again.

I ended up replacing the default ok button with a custom button, like so:

  var timeoffoptionpanel = $('#timeoffoptionpanel').mobiscroll().popup({
          display: 'top',
          scrollLock: false,
          buttons: [{
              text: 'Submit',
              handler: function (event, inst) {
                  submitRequest();
              }
          },'cancel'],
          okText: 'Save'
      }).mobiscroll('getInst')