Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

UI Action using GlideModal

aaron47
Mega Guru

 

Hello, my objective is to create a glide modal popup box to replace the "confirm" box.  This is because "confirm" is not supported by ATF.

 

The code below opens up a model box.

However when i click the "Close Pop up" button, it does nothing.  I was expecting the modal window to close.

 

Can someone please show me what went wrong?

function test(){ // client code

	var gm = new GlideModal('test');
	gm.setTitle('Test Pop up');
	gm.renderWithContent('<button style="padding:5px;margin-right:10px" onclick="window.closePopup" class="btn btn-default">Close Pop up</button>'); 
	
 window.closePopup = function(){
		gm.destroy();
	};
}

 

I should add, that I used this page as a reference for setting up the above:

https://www.servicenow.com/community/now-platform-articles/custom-glide-modal-dialog-boxes/ta-p/2321...

 

 

3 REPLIES 3

Mike_R
Kilo Patron

I would recommend using one of the ootb GlideModals instead.

Some examples provided here

https://davidmac.pro/posts/2022-02-08-glidemodal/

zz2
Tera Contributor

A little late to the party, 

but the following should fix your problem:

 

function test(){ // client code

	var gm = new GlideModal('test');
	gm.setTitle('Test Pop up');
	gm.renderWithContent('<button style="padding:5px;margin-right:10px" onclick="top.window.closePopup" class="btn btn-default">Close Pop up</button>'); 
	
 top.window.closePopup = function(){
		gm.destroy();
	};
}

leandrolope
Tera Contributor

Putting on the top solved it for me. Thank you!