I am trying to get a modal confirmation dialog when a user submits a form. My approach, as I thought logically, was to catch the presentation form. My code is as follows:
$('#multi-dialog-confirm').dialog({
autoOpen: false,
height: 200,
modal: true,
resizable: false,
buttons: {
'Confirm': function(){
return true;
},
'Cancel': function(){
$(this).dialog('close');
return false;
}
}
});
$('#completeform').submit(function(e){
e.preventDefault();
var n = $('#completeform input:checked').length;
if(n == 0){
alert("Please check the item and mark as complete");
return false;
}else{
var q = $('#completeform #qty').html();
if(q > 1){
$('#multi-dialog-confirm').dialog('open');
}
}
});
So, I set up my dialogue first. This is due to the fact that I am quite sure that the scope of the dialogue should be at the same level as the function that calls it.
However, the problem is that when you click "Confirm", nothing happens. Sending action does not continue. I tried too $('#completeform').submit();, which doesn't seem to work. I tried removing .preventDefault () to ensure that the form view is not completely canceled, but it does not seem to affect this and returns false.
, . - ;), "" , "", , .
- , !;)