doujiao7520 2019-02-11 14:42
浏览 53

Cakephp 3.6.14:如果表单不完整且用户离开页面,则出现确认消息

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

  • 写回答

1条回答 默认 最新

  • doufan1899 2019-02-12 07:46
    关注

    I ended up using this are-you-sure_plugin

    评论

报告相同问题?

悬赏问题

  • ¥15 WPF 大屏看板表格背景图片设置
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示