Monday, May 22, 2017

Selectbox laravel select onChange

I would like to filter some results depending on my selectbox "poule_id" in Laravel .

For exemple if i select the poule_id = 1 i want on the click that it display me all the teams who are in the poule_id = 1 ;

Anyone knows a good practice or a quick tutorial to achieve that ? i would like to use jquery for this.

Actually i have :

<div class="tab-pane" id="tab_2">
                        <div class="col-md-4 pull-right">
                            <label>Filtre par poule : </label>
                                {!! Form::select('poule_id', $select_poule ,null ,  ['class' => 'form-control']) !!}
                        </div>
                        @if($equipes->count() === 0 )
                            <div class="alert alert-info">
                                <h4><i class="icon fa fa-info"></i> Aucune equipes enregistrées</h4>
                            </div>
                        @else

                        <table class="table table-striped">
                            <thead>
                            <tr>
                                <th>Club</th>
                                <th>Nom de l'équipe</th>
                                <th>Bonus(+/-)</th>
                            </tr>
                            </thead>
                                <tbody>
                                @foreach($equipes as $equipe)
                                <tr>
                                    <td><a href="{!! route('club.show', $equipe->equipe->structure->id) !!}"></a></td>
                                    <td><a href="{!! route('equipe.show', $equipe->equipe->id) !!}"></a></td>
                                    <td>{!! Form::text('nb_bonus') !!}</td>
                                </tr>
                                @endforeach
                                </tbody>
                        </table>
                        @endif
                            <div class="box-footer">

                                <button type="button" class="btn btn-primary pull-right" data-toggle="modal" data-target="#myModal2">Ajouter une nouvelle Equipe</button> 
                            </div>
                    </div>



via Mathieu Mourareau

Advertisement