Hi
I am using Laracasts Form Validation Simplied (https://github.com/laracasts/Form-Validation-Simplified) approach in my project. I've an event listener set up to catch any form validation failure:
// Catch validation error
$app->error(function(\Extensions\Tpp\Forms\FormValidationException $e)
{
return \Redirect::back()->withInput()->withErrors($e->getErrors());
});
Then redirects back to previous page with Session Flash message
However the problem I've got is the session data stores twice. When it redirects back to the previous page, it shows the validation error, which is good, however if I refresh the page, I can still see the validation(Odd!), and I refresh the page again, the validation error disappears.
Thank you for your advice!
This may help.! After displaying the error, Remove the item from the session
Session::forget('key');
Add this after displaying error where 'key' is the item.
Hi Sikandhar,
Thank you very much for your reply. I believe Session::forget('key'); will work as well, but I am inclined to figure out why Session::flash('key') doesn't get flushed after the following request.
By the way, I am using Laravel 4.0.9, the session drive is native.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community