Hi Developers,
How to make sweet alert with Yes No button and submit form
I have developed a page and delete a record using yes & No alert.
Now i want to change the functionality to Sweet Alert with YEs & No option ,
If i click yes means it will fire the event delete the record ,
If i click No button means the popup will exit and noit frie the event...
Am using Vb.net code & js
Button code in VB :
<asp:Button ID="btnwallettopup" OnClientClick="return UserDeleteConfirmation();" CssClass="btn btn-default btnlogindesign" Text="Submit" runat="server" />
Working - Old Js Code :
if (issuccess == true) {
if (confirm("Are you sure you want to Proceed?"))
return true;
else
return false;
}
Not Working - New js code
if (issuccess == true) {
event.preventDefault(); // prevent form submit
var form = event.target.form; // storing the form
swal({
title: "Are you sure you want to Proceed?",
text: ".",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes",
cancelButtonText: "No, cancel please!",
closeOnConfirm: false,
closeOnCancel: false
},
function (isConfirm) {
if (isConfirm) {
form.submit(); // submitting the form when user press yes
} else {
swal("Cancelled", "Your imaginary file is safe :)", "error");
}
});
}
If anyone knows how to solve this problem kinldy suggest me
Regards
Paul.S