I am doing a filter for search in laravel. Using scope. I am using one Select
to filter by provinces and another for the months of the year.
I am using the JQuery Chosen plugin. Apart from giving a better aesthetic to the Select
, it incorporates a search engine.
The issue is that using this plugin does not perform the search. That is, when I enter on input, it does nothing (that is, it does not pass the data through the URL with GET)
Disabling Chosen (removing the selector from the select class) correctly sends the data by GET
<div class="margen">
<!-- BUSCADOR DE EVENTOS -->
{!! Form::open(['route'=>'front.search.eventos','method'=>'GET','class'=>'narvar-form']) !!}
<div class="input-group">
{!! Form::text('nombre',null,['class'=>'form-control','placeholder'=>'Buscar Evento Por Nombre...', 'aria-describedby'=>'search']) !!}
<span class="input-group-addon" id="search">
<span aria-hidden="true" class="glyphicon glyphicon-search">
</span>
</span>
</div>
<button aria-controls="collapseExample" aria-expanded="false" class="btn btn-primary" style="margin-top: 5px;" data-target="#collapseExample" data-toggle="collapse" type="button">
Busqueda Avanzada
</button>
<div class="collapse" id="collapseExample">
<div class="panel panel-default margen-top">
<div class="panel-body">
<div class="form-group">
{!! Form::label('provincia_id','Provincia:') !!}
{!! Form::select('provincia_id',$provincias,null,['class'=>'form-control select-provincia','placeholder'=>'Provincia del evento...']) !!}
</div>
<div class="form-group">
{!! Form::label('meses_id','Mes:') !!}
{!! Form::select('meses_id',$meses,null,['class'=>'form-control','placeholder'=>'Elija el mes del evento...']) !!}
</div>
</div>
</div>
</div>
{!! Form::close() !!}
<!-- FIN DEL BUSCADOR -->
</div>
<!-- /.row -->
@section('js')
<script>
$('.select-provincia').chosen({
width: "100%"
});
</script>
@endsection
Could you share the HTML generated by blade specifically from the 2 select? Both the one that has chosen and the one that doesn't?
For some reason for the improved select to work, I had to place a submit, I did it simply by modifying the first input-group a bit
then it doesn't matter when select adhere with chosen, it works fine