Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to keep SpModal window open if fields are empty?

Maxwell3
Kilo Guru

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?

find_real_file.png

When the user click ok on the alert message the modal window is goes away.

 

1 REPLY 1

Allen Andreas
Tera Patron

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!