首页 > 解决方案 > Laravel 5.7 - Redirect back to old tab and keep old value on each field

问题描述

I have code like this:

if ($validator->fails()) 
        {
            return back()
                ->withInput(['tab' => 'upload-doc'])
                ->withErrors($validator->errors());
        }

and on my blade template, I have jQuery like this:

$(document).ready(function () {
      $('#registrationTab a[href="#{{old('tab')}}"]').tab('show');
   });

When I click submit button and validator invoked, I redirected to current tab, but my value on each field gone.

How to redirect back to old tab and keep old value on each field?

标签: phplaravel

解决方案


推荐阅读