We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Flash getMessages remove

Hi, how can I remove flash messages from session after they have been shown?

In volt, i'm currently doing this

  {% for error in flash.getMessages('error', true) %}
    <li> {{ error }} </li>
  {%endfor%}

However it does not remove them, what should I use in order to do this?



6.9k

I'm going to assume you're using the getMessages for a reason here rather than the flash.output method. For sake of argument, have you tried using that method? does it show the same behavior?



4.5k
Accepted
answer
edited Nov '14

Well the reason is that I couldn't get them all displayed in one div, rather than apply a div for each of them, if that makes sense? In this way, I have more flexibility and I can display the error messages however I want, epecially when I have different kind of error messages.. Anyway, I got it working once I have changed the response to redirect instead of forward. Then I had some problems with flashing old inputs because again I didn't know how to do it:D but that's all sorted now so thanks anyway.



6.9k

Awesome, glad you got it fixed! :)

Any change you can mark your response as the solved answer?