Close spModal after 10 seconds

ashfaq
Tera Contributor

I am looking for a piece of code to delay the closure of the spModal box. Currently as soon as you click "OK" the box closes however, instead of this I am hoping there is a piece of code I can use on the client script that will delay the closure of this box once the OK button is clicked by 5 seconds. This is for the portal. I currently have the following code and I would like the box closing after the it has been updated on the server if that makes sense as there is a slight delay in the background therefore, I wanted to box closing once the background work has been done. So I would need to add some code after the server update I think. 

function(spModal) {
/* widget controller */
var c = this;
c.amendAuthorisedManager = function(value){
var warn = '<i class="fa fa-warning" aria-hidden="true"></i>';
if (value == true){
spModal.open({
size: 'sm',
title: 'Add as Authorised Manager',
message: warn + ' This will enable the user to request access to company owned data and systems on behalf of other users.<p>Are you sure you want to make the user an Authorised Manager?</p>'
}).then(function(confirmed) {
console.log('widget dismissed');
c.data.amendAuthorisedManager = 'Add';
c.server.update();

 

6 REPLIES 6

ashfaq
Tera Contributor

Thank you. Yes closed it properly but it just delays the actual action of ticking the box which I am having issues with so when I tick the authorised manager box and then click "OK" nothing happens for around 7 second seconds and then the tick appears on the box. So wanted something in place to either stop this or delay the box closing when pressing OK. 

If you want the tick to appear soon, then put this code above timeout function.

  c.data.amendAuthorisedManager = 'Add';
  c.server.update();

Delaying the closing of box is not possible as its default function. you can only delay anything after clicking on okay.

Mark the comment as a correct answer and helpful if this helps.