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

Why shows a flash messages without having pressed the submit button?

I want to know why a view show the flash message without having pressed the submit button

I have a menu layout for reuse


the menu is recursive

other views have forms (textbox, radio, select option ....)


the problem is that when you press a link redirects to a view showing the flash message of form

i am using inheritance of view and routing annottations

1-. Action -> views/users/create.volt
2-. Layout -> views/layouts/admin.volt
3-. Controller -> controllers/UserController
4-. Main -> views/index.volt

what is this problem?


Can you provide the controller code where you set the form and the flash message?

edited May '15

 * @RoutePrefix("/users")
class Users extends BaseController{

    * @Route("/register")
    public function registerAction(){
         $UsersForm = new UsersForm;

        if (!$UsersForm->isValid($this->request->getPost())){
            foreach ($UsersForm->getMessages() as $message) {
                return $this->dispatcher->forward(array(
                    'controller' => 'users',
                    'action' => 'index'