Page 1 of 1

Messagebox autohide

Posted: Thu Mar 29, 2018 4:58 am
by Timo
After a form has been saved, I display a message with nuMessage("Saved + other information..."]);. Now it would be nice if the message would go away on its own after a second. Is that possible?

Re: Messagebox autohide

Posted: Fri Mar 30, 2018 12:58 am
by admin
Timo,

The reason the message stays there is that sometimes a user might need to copy it when its still on the screen.

Steven

Re: Messagebox autohide

Posted: Fri Mar 30, 2018 5:52 am
by Timo
I agree, sometimes, especially when it is used to output an error message it should not go away on its own. In my case a short informative message is shown and it can disappear again after 1-2 secs

Re: Messagebox autohide

Posted: Fri Mar 30, 2018 6:46 am
by admin
.

Re: Messagebox autohide

Posted: Fri Mar 30, 2018 6:53 am
by toms
Timo, you can use a timeout and hide the messagebox:

Code: Select all

function custMessageTimeout(msg, timeout) {
      nuMessage(msg);
      setTimeout(function() {
         $('#nuMessageDiv').hide();
        }, timeout);
}

if (nuFormType() == 'edit') {

 if (nuIsSaved()) {		
        custMessageTimeout(["Entry saved"],1500);
}
			
}	

Re: Messagebox autohide

Posted: Fri Mar 30, 2018 11:07 am
by Timo
Thanks mate, that works!

Re: Messagebox autohide

Posted: Fri Mar 30, 2018 11:58 am
by admin
.