CakePHP确认窗口没有出现

CakePHP confirmation popup not appearing

本文关键字:确认 窗口 CakePHP      更新时间:2023-09-26

当用户单击提交按钮时,应该出现一个弹出框询问他们是否希望提交选择。我一直在添加视图,我刚刚注意到,虽然表单工作正常,但我不再收到要求确认选择的弹出窗口。

包含两个表。上面的一个用于显示信息,其中每行都有一个复选框。底部的表格允许您选择是只提交选中的复选框,还是提交表格中的所有行。

<table>
    <? 
    echo $this->Form->create(null,array(
                    'onsubmit'=>'return confirm("Are you sure you want to archive?'));
    ?>              
    <th>Order ID</th><th>Order Date</th><th>Order Total</th><th>Status</th><th>View</th><th>Select to Archive</th>
    <?php foreach ($orders as $order): ?>
        <tr>
            <td><?php echo $order['Order']['id'];?> </td>
            <td><?php echo $order['Order']['date']; ?></td>
            <td><?php echo $order['Order']['total'];?> </td>
            <td><?php echo $order['Order']['order_status'];?> </td>
            <td><a href="/orders/details/<?php echo $order['Order']['id']; ?>"/>View Order</a> </td>
            <td><? echo $this->Form->checkbox('archive_value.', array('hiddenField' => false, 'value' => $order['Order']['id'])); ?></td>
        </tr>
    <?php endforeach; ?>
</table>    
<table class = "table_order_status">
    <tr>
        <td width="350">
            <?
            echo $this->Form->input('archive_values', array('options' => $archive_options, 'value' => $select_value, 'name' => 'archive'));
            ?>
        </td>
        <td>
            <?
            echo $this->Form->end(__('Submit')); 
            ?>
        </td>
    </tr>
</table>

您在onsubmit选项中有一个错字。看看你的名言。我猜这行:

'onsubmit'=>'return confirm("Are you sure you want to archive?'));
应:

 'onsubmit'=>'return confirm("Are you sure you want to archive?")');