Quantcast
Channel: ASPRunner forums
Viewing all articles
Browse latest Browse all 2586

10.5 and SWAL

$
0
0
I am trying to implement a SWAL version of the following in my custom button Client Before event

This works fine

var r = confirm("Are you sure?");
if (r == true) {
return true;;
} else {
return false;
};

I have copied and pasted an example straight from the SWAL website (below), replacing the above code and have the following issues.

1. When I click on the Check Syntax button is displays a Microsoft Jscript compilation error.

2. Regardless, I pressed on and it fires without throwing an error, but it doesn't pause for user input (meaning than the Sever and Client After events were fired without me being able to capture a user response)

3. I then tweaked it again, trying to set a return true/return false in place of the 2nd and 3rd SWAL displays, but regardless of what I select a return true is executed, and the SWAl displays for about a second then auto closes

Original code from the SWAL website

swal({
title: "Are you sure?",
text: "Once deleted, you will not be able to recover this imaginary file!",
icon: "warning",
buttons: true,
dangerMode: true,
})
.then((willDelete) => {
if (willDelete) {
swal("Poof! Your imaginary file has been deleted!", {
icon: "success",
});
} else {
swal("Your imaginary file is safe!");
}
});


Version 2, which flashes on the screen, disappears without waiting for a response, and seems to issue a return true


swal({
title: "Are you sure?",
text: "Once deleted, you will not be able to recover this imaginary file!",
icon: "warning",
buttons: true,
dangerMode: true,
})
.then((willDelete) => {
if (willDelete) {
return true;
} else {
return false;
}
});

What am i doing wrong?

Viewing all articles
Browse latest Browse all 2586

Trending Articles