SweetAlert - a beautiful replacement for javascript's "alert"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2015 10:50 AM
SweetAlerts2 is out.
Hi Dev's,
Last night i was working on an application that needed some input. So i used SweetAlerts on the custom UI page and it turned out really nice looking, and i thought i could use globally!.
Once you install you can do any of the tests via the console
parent.swal({ title: "Are you sure?", text: "You will not be able to recover this imaginary file!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, delete it!", closeOnConfirm: false }, function(){ swal("Deleted!", "Your imaginary file has been deleted.", "success"); });
Make sure that you use "parent.swal()"
Here's more examples listed here SweetAlert
Screenshot's below.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2019 10:43 AM
Is there any examples of using SweetAlert in Catalog Client Scripts (Currently on CMS but moving to portal in the next few months). This is just a test script below as we want to use it is a confirmation on specific items that they included certain information before proceeding. No matter what I try, the pop-up stays on the screen for a quick second and then goes to the confirmation page (checkout). This is using an onSubmit
function onSubmit() {
swal({
title: 'Are you sure?',
text: "You won't be able to revert this!",
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes - Submit!'
}).then(function(result) {
if (result) {
return true;
} else {
return false;
}
});
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2019 07:28 AM
I am having the same exact problem. I tried something almost identical to this and the pop-up vanishes within a couple seconds, instead of waiting for the "Confirm" button to be clicked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2020 01:41 PM
same here, i played around and changed it to an onChange as that would be the only way the message stays up for long enough for someone to read it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2020 05:55 AM
Hi ,
The below snippet is from an on submit catalogue client script , but the browser does not wait for the user response and continues to execute the rest of the code . Is there a way to pause the execution until the sweet alert gets a response from the user ?
Thank you
Jose
swal({
title: 'Are you sure?',
text: "You won't be able to revert this!",
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes - Submit!'
}).then(function(result) {
if (result) {
return true;
} else {
return false;
}
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2021 02:33 PM
Wondering if anyone found an answer to the onSubmit question yet.
