CakePHP的3.6.14:确认信息,如果形式是不完整的,用户离开网页

问题描述 投票:0回答:1

我使用cakephp-3.6.14和我有这样的形式:

<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>

是否有可能显示一个确认消息,如“您确定要离开这个页面吗?”如果用户已经开始填写表格时,不慎(通过点击菜单项)重定向到另一个页面?

我想,如果用户已完成形式中的至少一个字段,只显示了确认消息。这是不是在这个question回答

javascript php jquery cakephp cakephp-3.x
1个回答
0
投票

我结束了使用此are-you-sure_plugin

© www.soinside.com 2019 - 2024. All rights reserved.