SP Modal Confirmation Pop-up Upon submission of request in the Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2019 07:41 PM
Hi Experts!
I am still a bit of a novice in terms of using SP Modal and the Service Portal. I hope you someone from the group can assist me in terms of creating an On Submit SP Modal confirmation pop-up that would stop the form from submitting before it sends out the request.
I was able to create a basic one using an On Submit Catalog Client Script but the SP Modal confirmation does not stop the request from being submitted and it still submits the request even if the user hasn't clicked on either "OK" or "Cancel". Does any have a suggestion regarding this?
var flag = 'false';
var message = g_form.getValue('message');
if (typeof spModal != 'undefined')
{
spModal.confirm("Please confirm if the message is correct: " + message).then(function(confirmed)
{
flag = 'true';
});
}
if (flag != 'true')
{
return "false";
}
}
- Labels:
-
Service Portal Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2019 10:01 PM
function onSubmit() {
var message = "test";
if (typeof spModal != 'undefined' && !g_scratchpad.checkFlag)
{
spModal.confirm("Please confirm if the message is correct: " + message).then(function(confirmed)
{
if(confirmed)
{
g_scratchpad.checkFlag = true;
g_form.submit();
}
else
{
g_scratchpad.checkFlag = false;
}
});
return false;
}
}
try this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2019 10:32 PM
Hi,
User the modal function but return false if you want to cancel the submit. You seem to be returning the string "false" instead of a boolean value false (without the qoutes).
Regards!