【问题标题】:Cakephp 3.6.14: Confirmation message if form is incomplete and user leaves pageCakephp 3.6.14:如果表单不完整并且用户离开页面时的确认消息
【发布时间】:2019-02-11 14:42:47
【问题描述】:

我正在使用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没有回答哪个@

【问题讨论】:

  • Intercept page exit event的可能重复
  • @Cid 我希望仅当用户至少完成了表单的一个字段时才显示确认消息。您作为重复提供的这个问题中没有回答。
  • 没有什么能阻止您检查该函数的输入值

标签: javascript php jquery cakephp cakephp-3.x


【解决方案1】:

我最终使用了这个are-you-sure_plugin

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-07-03
    • 2019-06-09
    • 1970-01-01
    • 1970-01-01
    • 2012-09-06
    • 1970-01-01
    • 2014-03-25
    相关资源
    最近更新 更多