Prevent form from submitting until Modal is closed in onSubmit client script
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2025 02:16 PM
(I am re-posting so that I can provide an improved answer to the original question.)
In the service portal we would like to start using Modals instead of alerts. One issue I'm having is when I write a script like this:
function onSubmit() {
if (typeof spModal != 'undefined') {
spModal.open({
message: 'Hello',
title: ''
});
} else {
var gm = new GlideModal();
gm.setTitle('');
gm.renderWithContent('Hello');
}
}
In the service portal after pushing submit, the form will submit after a few seconds without the user having pushed ok or closing the modal.
Is there any way to get it to perform more like an alert, requiring the modal to be closed before it submits and moves on to the next page?
0 REPLIES 0