1

Im using jConfirm in my JSP page for canceling submit button click.

As following code, although i clicked cancel button, but not return, and proceed below.

Why and how ?

Or is there another problem ?

I tried by also jquery-ui-dialog, but result is same ignored cancel.

$("#dtdetailsubm").click(function() {

  .....

  jConfirm('Really post ?', 'Post confirmation', function (r){

    if (r == false) {

      return false;

    }

  });

  ..... 

});
  • see http://stackoverflow.com/questions/3523700/prevent-script-from-running-using-jconfirm-like-native-confirm. You can stop by preventDefault() function. – Fabio Andrea Petrini Jul 08 '13 at 00:14

3 Answers3

0

Try intercepting the form submission itself rather than the submit button's click.

$("#dtdetailForm").on('submit', function() {
  .....
  if(!confirm('Really post?') {
      return false;
  }
  else {
      ..... 
      return true;
  }
});
Beetroot-Beetroot
  • 18,022
  • 3
  • 37
  • 44
0

Thanks for your suggestion. Confirmation dialog works good intercept But I use jConfirm on IE9. and still skipped or ignored.

http://labs.abeautifulsite.net/archived/jquery-alerts/demo/

0

see Prevent script from running using jConfirm like native confirm You can stop the action (event) with preventDefault() function.

Community
  • 1
  • 1