How to display a confirmation pop up message on a widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 12:38 AM
Hi everybody!
I need to display a confirmation pop up in a SR when the user click on Submit. In the pop up it should say "Are you sure you want to continue?" and there should be 2 bottons as Continue or Cancel. So when they click on continue the sr is submit, if they click cancel the action is aborted and they rest in the page without having send the sr.
I need this pop up in a widget so somebody could help me?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 12:52 AM
Are you looking to have this on the portal?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 12:54 AM
yes it's a widget display on a portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 04:00 AM - edited 05-08-2024 04:03 AM
Hi,
The simple way to do this is a confirm dialog. But the buttons are OK and Cancel
function onSubmit() {
//Type appropriate comment here, and begin script below
return confirm("Are you sure you want to continue?");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 04:36 AM - edited 05-08-2024 04:37 AM
A slightly more complex version would be the following: (please note this only works on the portal)
if (typeof spModal != 'undefined') {
if (g_scratchpad.isFormValid) {
return true;
}
spModal.open({
title: 'Are you sure you want to continue?',
buttons: [
{label:'Cancel', cancel: true},
{label:'Continue', primary: true}
]
}).then(function(confirmed) {
g_scratchpad.isFormValid = true;
var actionName = g_form.getActionName();
g_form.submit(actionName);
return true;
});
g_scratchpad.isFormValid = false;
return false;
}