i am creating a login form in which i have to set a flash message if login fails. i have used the following code to set flash message.
In actions.class.php inside that a function called executeLogin_process
$this->getUser()->setFlash('error', 'Invalid User Name or Password', false);
$this->redirect('login/index');
and to display the message in indexSuccess.php
<?php if ($sf_user->hasFlash('error')): ?>
<div class="flash_error"><?php echo $sf_user->getFlash('error') ?></div>
<?php endif ?>
By using this i am not able to display the error messages.i don’t know whether i am using the right code or not. Any one please help me…
Dont use the third parameter on your setFlash method.
This will work:
See: http://www.symfony-project.org/api/1_4/sfUser#method_setflash
If the third parameter is set to false. the flash msg will not persisted to pass a redirect.