Chosen Select and Input old Laravel

1455271800000 php laravel

by Start Bootstrap

Writing this Post after long time, which would help others if they use Chosen Menu


Here is the Link of Chosen Menu . Infact i use it for many of my projects, which is simple and free to use.


AFAIK You can customize this as per your need, today morning while i do some bed time programming i wanted to restore the selected items after validation, it was a form post action, What i did is simple..


1. Check if the old inputs were there

2. If so, then get the old inputs and iterate along to check the presence in_array


Here you go

@foreach($types as $type)
<option value="{{ $type->id }}"  <?php if(Input::old('type')) { if(in_array($type->id, Input::old('type'))) { echo 'selected="selected"'; } }?> > {{ $type->name }} </option>


You shall break it down to look deeper :)