I am using cakephp-3.6.14
and I have this form:
<div class="customers form large-9 medium-8 columns content">
<?= $this->Form->create($customer) ?>
<fieldset>
<legend><?= __('Edit Customer') ?></legend>
<?php
echo $this->Form->control('company');
echo $this->Form->control('name');
echo $this->Form->control('surname');
echo $this->Form->control('tel');
echo $this->Form->control('mob');
echo $this->Form->control('email');
echo $this->Form->control('customer_type_id', ['options' => $customerTypes, 'empty' => true]);
echo $this->Form->control('business_type_id', ['options' => $businessTypes, 'empty' => true]);
echo $this->Form->control('business_name');
echo $this->Form->control('balance');
echo $this->Form->control('birthday', ['empty' => true]);
echo $this->Form->control('notes');
echo $this->Form->control('user_assigned');
echo $this->Form->control('created_by');
echo $this->Form->control('created_date', ['empty' => true]);
echo $this->Form->control('modified_by');
echo $this->Form->control('modified_date', ['empty' => true]);
echo $this->Form->control('Address');
?>
</fieldset>
<?= $this->Form->button(__('Submit')) ?>
<?= $this->Form->end() ?></br></br>
Is it possible to show a confirmation message like "Are you sure you want to leave this page?" if the user has started completing the form and accidentally (by clicking on a menu item) redirects to another page?
I want the confirmation message to be displayed only if the user has completed at least one field of the form. Which is not answered in this question