setFlash not working with Post-Request

Hey there,


Yii::app()->user->setFlash('info','Lorem Ipsum');

$this->redirect('/');



is perfectly working on GET-Request.

But my Action can also handle POST-requests. But then the method setFLash() is not working anymore?

Any ideas? Bug?

Best regards,

Philipp

Setting flash:




Yii::app()->user->setFlash('info','Lorem Ipsum')



is request-type independent, since it stores variable into session.

Your issue has nothing to do with the type of request (POST/GET) - most likely the cause of problem is somewhere else… e.g. you may have two redirects coming after each other where the first one will read flash message and then following redirect would not find it…

Same issue here.

I found it caused by ajax duplicated request

in 1.1.9 this problem is still there. should it be considered a bug?

the problem is that Yii is not creating a new ID for the link/button inside the flash message. then it is duplicated and it triggers a wrong ajax request. i wish to use flash messages for undo operations…

for example, that won’t work:




$message = CHtml::link('Undo', '#',array('submit'=>array('trash/restore/id/'.$model->id)));

Yii::app()->user->setFlash('success', $message);