I’m using struts2-jquery plugin in my application, i’m using its sj:a component to submit forms. Everything works fine until a requirement came up that I’ve to display a confirmation dialog before submission of the form. I’m using jquery.alert plugin for displaying confirmation dialog.
The problem is that in this jconfirm dialog is not blocking, the jconfirm message is displayed but the event continues its execution. Any ideas on how to stop execution of beforesubmit event until user clicks the confirmation dialog?
I’m using following code
var result = false;
if(flag == 'true') {
jConfirm("Message", "Note", function(choice) {
if(choice) {
submitFlag = true;
$.publish('beforeSaveMilestoneSubmit');
}
});
} else {
submitFlag = true;
$.publish('beforeSaveMilestoneSubmit');
}
I found a solution here for this problem. This solution is a little hacky, but it worked very well for me. The solution is:
Java Script here: