JavaScript Problem With Remove Status function

  • 9 December 2020
  • 2 replies
  • 1 view


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() {
}, 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


Best answer by s_aussmann 9 February 2021, 15:11

View original

2 replies

Update: Including the script into "Custom JavaScript" part inside the Nintex form is working, using a link to a JavaScript file is not working.

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);

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.