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 07:55 PM
Why dont you use confirm?
function onSubmit() {
var message = g_form.getValue('message');
return confirm("Please confirm if the message is correct: " + message);
}
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2019 08:05 PM
Thanks for the suggestion Sanjiv! I've considered that but our stakeholder would want a more customized approach to it hence we've considered using SP Modals. I guess the challenge here is that whenever the confirmation message shows up the requests still gets submitted even if the response from the confirmation modal has not been selected yet.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2019 08:18 PM
var message = g_form.getValue('message');
if (typeof spModal != 'undefined')
{
spModal.confirm("Please confirm if the message is correct: " + message).then(function(confirmed)
{
g_form.submit();
});
return false;
}
}
try this!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2019 09:06 PM
Thanks Satheesh it works! Just one last thing, the modal gets stuck in front even if you press 'OK' and the form still does not submit.