s_aussmann
Rookie

JavaScript Problem With Remove Status function

Jump to solution

Hi,

like to add status messages to an Nintex form. The adding is working fine, but if I try to remove

the status message after some time with

setTimeout(function() {
SP.UI.Status.removeStatus(statusId);
}, 3000);

the script returns an call stack error. On the other hand SP.UI.Status.removeAllStatus(true); in the same Timeout function is working well but it's not requested to remove all status messages at the same time.

 

If I use this at an SharePoint site without Nintex, there's no problem, so the error is not inside the code.

Is there any way to implemnt this to an Nintex form, too or any other way to set status messages ?

Thanks Stefan

0 Kudos
Reply
2 Replies
s_aussmann
Rookie

Re: JavaScript Problem With Remove Status function

Jump to solution
Update: Including the script into "Custom JavaScript" part inside the Nintex form is working, using a link to a JavaScript file is not working.
0 Kudos
Reply
s_aussmann
Rookie

Re: JavaScript Problem With Remove Status function

Jump to solution

Ok, found an working solution. At least the problem was if I add more than one status message, only the last is removed.

So I added an array to the script

statusId = SP.UI.Status.addStatus("Failure", "Please insert an value into field...", true);
statusArr.push(statusId);

and with

setTimeout(removeStatusMsg, 20000);

after some time the removeStatusMsg function is accessed

function removeStatusMsg() {
SP.UI.Status.removeStatus(statusArr[0]); -> this removes the first status id in the array, usually "status_1"
statusArr.splice(0,1); -> removes the first entry from the array, and makes the second to the first entry

 

This means the status messages will be removed in the sequence they were created  first status_1, than status_2 et cetera... It's not possible to set different time intervalls to the messages, but for my purpose it's working fine so.

 

 

 

 

 

 

0 Kudos
Reply