Sweet alert for Onsubmit client Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2018 09:04 AM
Hi,
I am trying to display alert using swal onsubmit client script. I tried the below code. But the issue is, it popup the message and stayed for 10 to 15 seconds and disappears.
function onSubmit() {
swal({
title: 'Message',
html: true,
width:'100px',
text: 'Please: <a href = "www.google.com" target="_blank">Click here</a>',
});
}
So, I modified the code as below which doesn't submit at all even 'OK' is clicked
function onSubmit() {
swal({
title: 'Message',
html: true,
width:'100px',
text: 'Please: <a href = "www.google.com" target="_blank">Click here</a>',
},function(){
});
}
I am looking for something alert stays up until 'OK' is clicked and submit the form.
Did anyone try this before? Please let me know
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-26-2018 01:05 PM
You have discovered the fatal flow of SweetAlerts in ServiceNow (at least unless ServiceNow implements it natively). See these links for some discussion:
https://share.servicenow.com/app.do#/detailV2/ef0129de45b642007c39bada468d18f3/comments
https://community.servicenow.com/community?id=community_question&sys_id=c3d6cba5db1cdbc01dcaf3231f96195c&view_source=searchResult
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-26-2018 01:10 PM
Hi Sindhu,
Try this:
function onSubmit() {
swal({
title: 'Message',
html: true,
width:'100px',
text: 'Please: <a href = "www.google.com" target="_blank">Click here</a>',
confirmButtonText: 'OK',
});
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-26-2018 01:16 PM
Hi Sindhu,
Try adding this line to your code at the end.
confirmButtonText: 'OK',
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-26-2018 02:06 PM
try this https://stackoverflow.com/questions/29945646/sweet-alert-timer-done-function
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2020 05:55 AM
Hi, Do you happen to have any solution for this? I am looking for the same. Please let me know. Thank you.