简体   繁体   中英

How to fixed page reload same on form submit with laravel

LARAVEL
I have face one problem regarding same page reload on form submit, event not call __construct() method.
Also I set debug in construction then nothing print there(might be it not call).

FYI : If I have remove disable element in form then its working fine.
But I want some disable element.

Form

{!! Form::open(["route"=>"work.update", 'files' => true, 'id' => 'add_work', 'name' => 'add_work']) !!} {!! Form::hidden("id",$workdetail->id) !!}
                            {{--{{ csrf_field() }}--}}
                            <div class="col-md-12 col-sm-12 col-xs-12 mb16 pull-right">
                                <a href="{{route('export.workorder.detail',$workdetail->id).'/xls'}}" id="exportxls" class="btn btn-warning pull-right" name="exportxls" title="Export To Excel">
                                    <i class="fa fa-download"></i> Excel
                                </a>
                                <button type="submit" class="btn btn-warning pull-right">Save</button>
                                <button type="submit" name="next" value="next" class="btn btn-warning pull-right">Save & Next</button>
                                @isset($amendment_workdetail->id)
                                    <a href="{{route('work.edit',$amendment_workdetail->id)}}" class="btn btn-info pull-right" title="Amendment Work Order">
                                        Amendment Work Order
                                    </a>
                                     @endisset($amendment_workdetail->id)
                            </div>
                            <div class="col-md-12 col-sm-12 col-xs-12">
                                <div class="row">
                                    <div class="col-md-3 col-sm-12 col-xs-12 hide">
                                        <div class="form-group select2-area">
                                            {!! Form::label("ven_code","Client") !!}
                                            <small class="grey">(Select Client And their Company)</small>
                                            {!! Form::select("ven_code",$vendor,isset($workdetail->ven_code)?$workdetail->ven_code:null,["class"=>"form-control select2 required-input","id"=>"ven_code","placeholder"=>"Select Client"]) !!}
                                        </div>
                                        <label for="ven_code" generated="true" class="error"></label>
                                    </div>
                             <div class="col-md-12 col-sm-12 col-xs-12 mb16">
                                <button type="submit" class="btn btn-warning pull-right">Save</button>
                                <button type="submit" name="next" value="next" class="btn btn-warning pull-right">Save & Next</button>
                            </div>
                            {!! Form::close() !!}

Controller

public function __construct(Request $request){
        if(isset($request->next)){
            dump($request->all());
        }
    }

Routes

Route::group(["as"=>"work.","prefix"=>"work/"],function (){
    Route::post("update","WorkController@update")->name("update");
});

Please help me for the same.

Thanks in advance.

I have find the solution and it was validation issue. If I can use disable element in laravel validation than this problem face. So I can us only non-disable element in validation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM