'Lists in validation Laravel
I am doing a validation of a form in Laravel.
In this form I have two inputs (one text and one checkbox).
But I have two lists, in which I can move the elements from one list to another and order them.
But I don't know how to send these lists through the form to the Laravel validation.
Thanks in advance
My form:
<form id="create-menu-opac" action="{{ route('post_create_menu_opac')}}" method="post" role="form" autocomplete="off">
{{ csrf_field() }}
...
<section>
<div class="row">
<div class="col-sm-6">
<h6>{{ trans('menu-opac.buttons_avaiable') }}</h6>
<ul id="buttons_no_selected" class="list-group list-group-sortable-connected connected">
@foreach ($buttons as $button)
<li id="{{$button->id}}" class="list-group-item list-group-item-info">{{$button->description}}</li>
@endforeach
</ul>
</div>
<div class="col-sm-6">
<h6>{{ trans('menu-opac.items_menu') }}</h6>
<ul id="buttons_selected" class="list-group list-group-sortable-connected connected">
</ul>
</div>
</div>
</section>
...
</form>
This two lists work with a library Jquery and Boostrap
My controller
foreach ($request as $_request) {
Log::Debug(print_r($_request,true));
}
In this Log I can see the two inputs (type text and type checkbox), but i can't see the list.
Solution 1:[1]
Try adding input hidden in your blade file then see if you get the data in your $request
@foreach ($buttons as $button)
<li id="{{$button->id}}" class="list-group-item list-group-item-info">{{$button->description}}</li>
<input type="hidden" id="{{$button->id}}" value="{{$button->description}}" name="{{$button->description}}">
@endforeach
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
