How to keep SpModal window open if fields are empty?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2022 05:29 PM
Hello,
I am using spModal.open to open a custom widget from a catalog client script. The widget is used to update the catalog item variables.
If the fields are empty, I would like the spModal window to stay open when the user clicks 'ok'.
I am able to display an Alert message through the catalog client script if the fields are empty but the modal window closes after the message is displayed.
Is there a way to keep the modal window open?
When the user click ok on the alert message the modal window is goes away.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2022 06:05 PM
Hello,
Please see this thread for assistance: https://community.servicenow.com/community?id=community_question&sys_id=e10cb918dbb35c50a08a1ea66896...
Essentially, when the user clicks the OK button...that is when your script runs. So in this workaround presented, you would evaluate and if no response per your liking, you can re-trigger the modal window again.
You may want to consider using: $uibModal instead for more features/functionality if you don't like the approach mentioned above.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!