• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

227
Views
No se puede dirigir a una ruta al hacer clic con valor con laravel

Tengo que agregar el valor de la fecha cuando hago clic en el hipervínculo en mi ruta, así que agrego así:

 <div class="card-body"> <div class="form-group"> <label>Tanggal Awal:</label> <input type="date" class="form-control" id="exampleInputPassword1" placeholder="Masukkan Tanggal Lahir" name="tglawal" id="tglawal"> </div> <div class="form-group"> <label>Tanggal Akhir:</label> <input type="date" class="form-control" id="exampleInputPassword1" placeholder="Masukkan Tanggal Lahir" name="tglakhir" id="tglakhir"> </div> <a href="" onclick="location.href='/cetaklaporanpasien/'+document.getElementById('tglawal').value + '/' + document.getElementById('tglakhir').value " class="btn btn-block btn-primary border-0" style="background-color: #6998AB">Cetak</a> </div>

Mi Ruta:

 Route::get('/cetaklaporanpasien/{tglawal}/{tglakhir}', 'LaporanController@cetakLaporanPasien')->name('cetaklaporanpasien');

Pero no se dirige a mi ruta. Entonces, ¿cómo agregar la ruta laravel con parámetro en onclick?

almost 3 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Intenta usar <button> en lugar de <a>

Así que será así:

 <button type="button" onclick="(your link)">Button</button>
almost 3 years ago · Juan Pablo Isaza Report

0

Debería considerar usar una plantilla de hoja, ya que es una plantilla estándar de Laravel.

 <div class="card-body"> <div class="form-group"> <label>Tanggal Awal:</label> <input type="date" class="form-control" id="exampleInputPassword1" placeholder="Masukkan Tanggal Lahir" name="tglawal" id="tglawal"> </div> <div class="form-group"> <label>Tanggal Akhir:</label> <input type="date" class="form-control" id="exampleInputPassword1" placeholder="Masukkan Tanggal Lahir" name="tglakhir" id="tglakhir"> </div> <a href="" onclick="cetakLaporan" class="btn btn-block btn-primary border-0" style="background-color: #6998AB">Cetak</a> </div> <script> let tglawal = document.getElementById('tglawal').value; let tglakhir = document.getElementById('tglakhir').value; function cetakLaporan(){ location.href = `/cetaklaporanpasien/${tglawal}/${tglakhir}` } </script>
almost 3 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error