i have a form and a complex validation Javascript which part of it is the following simplified code:
if (Condition1 Meets criteria){
Swal.fire({ //Cancel if Condition 1 Meets Criteria
title: 'Validation Problem',
icon: 'error',
html: 'Form wont be submited because <b>Condition 1 met criteria</b>',
showCloseButton: false,
focusConfirm: false,
confirmButtonText: 'Return'
})
return false; //Prevent submit form
}else if (Condition2 Meets criteria){
Swal.fire({ //Warning msg if Condition 2 Meets Criteria
title: 'Warning msg..',
icon: 'warning',
html: 'Condition 2 meets criteria </br>'+
'Are you sure you want to continue ?',
showCloseButton: false,
focusConfirm: false,
reverseButtons: true,
cancelButtonText: 'Cancel',
confirmButtonText: 'Continue'
}).then((result) => {
if (result.isConfirmed) {
alert ("Continue to next Rule!");
return true; //User confirmed to continue, Procceed to Validation 3 Rule...
}else{
alert ("Stop Submit Form!");
return false; //Dont submit Form
}
})
}else if (Condition3 Meets criteria){
...........
}
Condition 1 works good, Condition 2 ignores the msg the user will press . What am I doing wrong ? Simple alerts do show up so condition is met, but if I will comment the Alerts, system doesnt go on to return functionalities...