Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

598
Vistas
Return to same tab after form submit laravel 8

I have a view with multiple tabs. Each having different forms. When I submit a form from one tab, it returns to same page but primary tab. How could I get to return to same tab from which I was working.

controller

  public function updateProfile(Request $request)
   {

        $user = User::where('id', Auth::user()->id)->first();
        $user->update([
            'full_name' => $request->full_name,
            'phone'     => $request->phone,
        ]);
    }

    return redirect()->back();
 }

html form

<form  action="{{route('management.update')}}" method="POST" enctype="multipart/form- 
data">
      

This is how my tabs are :

      <ul class="nav nav-tabs mb-5" id="ex1" role="tablist">
          <li class="nav-item" role="presentation">
                <a class="nav-link active" id="ex1-tab-2" data-mdb-toggle="tab" href="#ex1- 
                   tabs-2" role="tab"
                aria-controls="ex1-tabs-2" aria-selected="false"><i class='bx bxs-user- 
                 rectangle'></i> User</a>
            </li>
            @endif
            <li class="nav-item" role="presentation">
                <a class="nav-link " id="ex1-tab-1" data-mdb-toggle="tab" href="#ex1-tabs-1" 
                  role="tab"
                    aria-controls="ex1-tabs-1" aria-selected="true"><i class='bx bx- 
                 buildings'></i> Profile</a>
            </li>
        </ul>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

On the controller send the data on which tab should be set active after redirect. You can do it by sending flash session.

Session::flash('active-tab', '#ex1-tab-1'); 

Then on the view end, check if the session exists and make the tab active with the data on session.

@if(Session::has('active-tab'))
@php
    $active_tab= Session::get('active-tab');
@endphp
$(document).ready(function(){
     $(".active").removeClass("active");
     $('{{$active_tab}}').addClass("active");
})

@endif
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda