Support the ongoing development of Laravel.io →
posted 10 years ago
Views
Last updated 2 years ago.
0

Maybe:

->with(array("messages"=>$this->user->errors));
Last updated 2 years ago.
0

still

Undefined variable: messages (View: 

but i found that in the docs but i cant get it [This is a link]http://laravel.com/docs/validation under named error

Named Error Bags If you have multiple forms on a single page, you may wish to name the MessageBag of errors. This will allow you to retrieve the error messages for a specific form. Simply pass a name as the second argument to withErrors: return Redirect::to('register')->withErrors($validator, 'login');
Last updated 2 years ago.
0

Why do you want to do that ?

Last updated 2 years ago.
0

i found it .. second reply here http://stackoverflow.com/questions/17047116/laravel-validation-attributes-nice-names

return Redirect::route('page')->withErrors(array('register' => $validator));

so i will get it under

{{$errors->register->first('username)}}
Last updated 2 years ago.
0

i had 2 forms one for login and other for sign up in one page so the variable $errors->first('username') is identical for login and sign up

Last updated 2 years ago.
0
Solution

So as you mentioned with named errors

return Redirect::to('whatever')->withErrors($validator, 'login');

then in the views

{{ $errors->login->first('username') }}
Last updated 2 years ago.
0

now i get that error :D http://oi59.tinypic.com/e7kqpw.jpg

Last updated 2 years ago.
0

yeah it's better thanx pmall

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.