I am not using cookie just session only, i think so validation has big data so maybe cannot store in cookie, do you have any suggestion ? , i think my code is simple so i will keep like that, but if you have another solution for solve validation error message, it;s will be nice .
I mean what do you use to store the session data in, what have you configured as driver in your session.php configuration file?
If that says cookie, your storing all session data in the cookie, and that has a limit of 4Kb. With luck you can get 2 validation objects in that, but probably not.
Instead of passing the entire object, just pass the messages. Or redesign the application flow, I usually redirect away after success, and let the code fall through on an error. Then you don't need to store anything in the session, you can pass everything directly to the view...
in my session configuration I am using driver file for store session ------------------------------------------------------------------------------------------------------------------------
Ok, the file driver should not have a size restriction.
Have you looked at the example? There is no redundant code in there, it just falls though, and ends with creating the view, no matter what happened before (initial load, reload on error, etc).
ok , maybe it's little difficult to explain, but it's possible to keep one old my handling error message using session ?, because now I am still cannot get session flash for that.
No, set() and set_flash() are treated equally in the code, and saved at the same time and the same way.
You don't have a second redirect somewhere, so that it redirects twice before getting to the method that fetches the flash data? Because flash data expires on the next page request.
Unless you set 'flash_auto_expire' to false in your config, in which case the flash variable remains available until you get_flash() it.
if ($post = \Input::post()) { if ($form->validation()->error()) { \Session::set_flash('errors', $form->validation()->error()); \Session::set_flash('input', $form->validation()->input()); \Response::redirect(\Uri::current()); } }
Which as far as I can see does what you do, only with a different redirect URL.
We use a standard session setup (so with auto expire of flash variables), and we use DB as session backend. And we run 1.7/develop, but afaik there are no differences in the session code.
If I request this URL, and submit the empty form (which causes 6 validation errors), it reloads the page and displays the two dumps without problems. So no issues with flash variables here.
When I change the session driver to "file", it behaves exactly the same.
So I'm pretty sure it's not something caused by the framework.