mercredi 25 novembre 2015

how to keep form data after click FORM submit button LARAVEL

I want to keep my dropdown selected values after submitting the form . currently when I click submit it disappear all data.

what I want is after submitting form first two drop down boxes values should keep as selected values unless user refress the page..

how to keep Select driver and select week drop down selected values after submit form ? pls advice

here is my code

  <form class="form-inline"  action="{{ action('TimesheetsController@store') }}" method="POST" >
                                <input type="hidden" name="_token" value="{{ csrf_token() }}">
                                    <div class="section-one">
                                <div class="form-group driver-drop">
                                    <div class="input-group">
                                        <select class="form-control" id="user_id" name="user_id" required="required">
                                            <option disabled selected>Select Driver:</option>
                                            @foreach($Role_user as $Roles)
                                                        <option value="{{ $Roles->id }}">{{ $Roles->username }}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <div class="input-group">
                                        <select class="form-control" id="week_starting_date" name="week_starting_date" required="required">
                                            <option disabled selected>Select Week:</option>
                                            @foreach($weeks as $weeks)
                                                <option value="{{ $weeks->id }}">{{ $weeks->week_starting_date }}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                </div>
                                    </div>
                                </br></br>
                                <div class="section-two">
                                    <div class="form-group">
                                        <div class="input-group">
                                            <select class="form-control" name="run_type">
                                                <option disabled selected>Run Type</option>
                                                <option value="S">S</option>
                                                <option value="G">G</option>
                                                <option value="R">R</option>
                                            </select>
                                        </div>
                                    </div>


                                    <div class="input-group">
                                        <input type="text" id="timesheet_date" name="date" class="form-control" required value="{{old('date')}}">
                                        <label class="input-group-addon btn" for="date"><i class="fa fa-calendar"></i></label>
                                    </div>


                                    </br>
                                    </br>


                                    <div class="form-group">
                                        <label for="">Shift Start:</label>

                                        <div class='input-group date' id='datetimepicker3'>
                                            <input type='text' name="shift_start" class="form-control" required id='datetimepicker3' value="{{old('shift_start')}}"/>
                                            <span class="input-group-addon"><span class="glyphicon glyphicon-time"></span></span>
                                        </div>


                                        <div class="form-group">
                                            <label for="">Shift End:</label>
                                            <div class='input-group date' id='datetimepicker5'>
                                                <input type='text' name="shift_end" class="form-control" required value="{{old('shift_end')}}"/>
                                            </div>
                                        </div>

                                    </div>
                                    </br>
                                    </br>

                                     <div class="form-group">
                                            <div class="form-group">
                                            <div class="input-group">
                                        <button  style="width:160px;" type="submit" class="btn btn-default  btn-bottom-margin">Add Shift</button>
                                    </div></div>


                                        <div class="form-group">
                                            <div class="input-group">
                                                <button  style="width:160px;" type="reset" class="btn btn-default  btn-bottom-margin">Clear</button>
                                            </div>
                                        </div>

                                    </div>

                            </form>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire