Hello everyone. Quick question. Is it possible to output flash messages only of a certain type. I have this little script that collects form errors and assigns them to the flash object (I am using flash session - not direct);
foreach ($form->getMessages() as $msg)
{
if (!$this->flash->has($msg->getField())) {
$this->flash->message($msg->getField(), $msg->getMessage());
} else {
$this->flash->message($msg->getField(), implode('<br />', $this->flash->getMessages($msg->getField())). '<br />' . $msg->getMessage());
}
}
And if I try to do something like this:
$this->flash->output('Password');
I get an all the messages and they are being appended to the prevoius ones. More so, they are being displayed in a strange order putting all of the messages of a field password to the end.
Wrong email format
Required
Email must be at least 8 characters long
Password must be at least 8 characters long
This is what I get if I simply use $this->flash->output();
And this after I've reloaded a page a couple of times:
Wrong email format
Required
Email must be at least 8 characters long
Wrong email format
Required
Email must be at least 8 characters long
Wrong email format
Required
Email must be at least 8 characters long
Password must be at least 8 characters long
Password must be at least 8 characters long
Password must be at least 8 characters long