Search code examples
erlangnitrogen

Unflash a message with Nitrogen


I have a login page for my Nitrogen based web app. If user authentication fails I wf:flash a message to the user to let them know. However if the user continues to supply bad credentials these flash message keep building up. Is there a way to first clear the flashed messages before posting a new one?


Solution

  • I was able to remove the original flash message by calling:

     wf:update(page__flash, [])
    

    before updating with the new message (via wf:flash(Message)). page__flash is the id of the flash container div, and I just set it's content to be empty.