When I submit the form I am checking the validations. If validation true then I need to show confirmation. Currently, it is not showing. When validation true not shown confirmation, the form is submitted.
here is my js code:
$(document).ready(function () {
$('#reason').keyup(function () {
var val = $('#reason').val();
if (val == null || val == "") {
$('#reason_error').html('Please provide a reason.');
validation = false;
} else {
$('#reason_error').html('');
}
});
});
function finishCancelValidate() {
var validation = true;
var val = $('#reason').val();
if (val == null || val == "") {
$('#reason_error').html('Please provide a reason.');
validation = false;
} else {
$('#reason_error').html('');
}
if (validation) {
//alert('hi');
jQuery.confirm({
text: "Do you want to proceed this ?",
confirm: function () {
console.log("You just confirmed.");
return false;
},
cancel: function () {
console.log("You just cancel.");
}
});
} else {
return validation;
}
}
this is form tag :
<form method="post" class="register" action="finishController.php?a=cancel" name="cancel" onsubmit="return finishCancelValidate();" enctype="multipart/form-data">