From 72be52f06d1203c4d032f6f891e76307a92db764 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Mon, 23 Nov 2026 11:27:56 +0000 Subject: [PATCH] Reload the booking form when it is restored from the back-forward cache After tapping "Sende" the submit button is locked to stop double bookings. If the guest then pressed Back, the browser could restore that snapshot with the button still locked and unusable. The form now reloads in that case, matching the manage-booking page. Co-Authored-By: Claude Opus 5.5 --- application/views/pages/includes/booking-form-en.php | 8 ++++++++ application/views/pages/includes/booking-form-hu.php | 8 ++++++++ application/views/pages/includes/booking-form-no.php | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/application/views/pages/includes/booking-form-en.php b/application/views/pages/includes/booking-form-en.php index 6fd2fd7..b1b3330 100755 --- a/application/views/pages/includes/booking-form-en.php +++ b/application/views/pages/includes/booking-form-en.php @@ -214,6 +214,14 @@ $('#sendBooking').prop('disabled', true).val('Sending...'); }); + // Back button can restore this page from the browser cache with the + // submit button still locked - reload so the guest gets a fresh, usable form. + $(window).on('pageshow', function(e){ + if(e.originalEvent && e.originalEvent.persisted){ + window.location.reload(); + } + }); + $('#booking_time').change(function(){ if($('#booking_time').val() != ''){ $('#isTimeSelectedBtn').prop('disabled', false); diff --git a/application/views/pages/includes/booking-form-hu.php b/application/views/pages/includes/booking-form-hu.php index 0e2a642..8b0ebe0 100755 --- a/application/views/pages/includes/booking-form-hu.php +++ b/application/views/pages/includes/booking-form-hu.php @@ -213,6 +213,14 @@ $('#sendBooking').prop('disabled', true).val('Küldés...'); }); + // Back button can restore this page from the browser cache with the + // submit button still locked - reload so the guest gets a fresh, usable form. + $(window).on('pageshow', function(e){ + if(e.originalEvent && e.originalEvent.persisted){ + window.location.reload(); + } + }); + $('#booking_time').change(function(){ if($('#booking_time').val() != ''){ $('#isTimeSelectedBtn').prop('disabled', false); diff --git a/application/views/pages/includes/booking-form-no.php b/application/views/pages/includes/booking-form-no.php index 86eb3b7..15f4efa 100755 --- a/application/views/pages/includes/booking-form-no.php +++ b/application/views/pages/includes/booking-form-no.php @@ -213,6 +213,14 @@ if (is_array($services) && count($services) > 0) { $('#sendBooking').prop('disabled', true).val('Sender...'); }); + // Back button can restore this page from the browser cache with the + // submit button still locked - reload so the guest gets a fresh, usable form. + $(window).on('pageshow', function(e){ + if(e.originalEvent && e.originalEvent.persisted){ + window.location.reload(); + } + }); + $('#booking_time').change(function(){ if($('#booking_time').val() != ''){ $('#isTimeSelectedBtn').prop('disabled', false);