mercredi 27 avril 2016

How to display validation errors next to related input field (not as a list) in Laravel 5?

Default solution is trivial:

@if (count($errors) > 0)
<ul id="login-validation-errors" class="validation-errors">
    @foreach ($errors->all() as $error)
    <li class="validation-error-item"></li>
    @endforeach
</ul>
@endif

and I can include errors.blade.php anywhere.

Is there anyway to extract each element and display it next to input field that holds failed value?

I assume that would require to define a lot of conditional statements next to each input. Am I right? How to sort this problem? Could you give any examples?

Thanks.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire