Delete show message output after some time

Hi, We use 'Show 'Message' activities in our flows to alert the user to thing on the screen. For example, if no errors are found, a message in the bottom left will show saying 'Geen fouten in het dossier gevonden'. However. The user must click this message for it to dissappear. Since our users won't be using a mouse very often using this system, I'm wondering if we can automatically remove these messages after a certain amount of time
3 answers

As of Mendix 4 I don't think this option is configurable. I think you'll need some custom javascript event to grab the Mendix toasters and add a fade out event to them.

See this dojo documentation:



I don't think you can close those messages automatically. One idea: you could show a popup web form instead and put a microflow timer on that web form that calls a close form microflow after a certain amount of time has elapsed.



So, I have "a" solution that should be cross-browser supported. Some of the other pieces I saw either drained performance or were not supported across browsers like IE. Let me preface this by saying I'm in no way a good js developer. But if you want to test this out, it worked for me:

(function() {

//Set time to check
var checkInterval = 3000,
lastNumOfToasters = 0;

setInterval(function () {
    var toasters = dojo.query('.mendixToaster_message');

    if (lastNumOfToasters == toasters.length)
        for (var i = 0; i < toasters.length; i++)

    lastNumOfToasters = toasters.length;

}, checkInterval);


Save this text as AddMxToasterFade.js in the 'theme' directory of your project. Then load it in your index3.html page with a basic script tag right below mxui.js.

<script type="text/javascript" src="AddMxToasterFade.js"></script>

I have not done a lot of testing - again, this was a 5 minute solution, but feedback would be great.