简体   繁体   English

CakePHP确认弹出窗口未出现

[英]CakePHP confirmation popup not appearing

When a user clicks a submit button a popup should appear asking them if they wish to submit the selection. 当用户单击提交按钮时,将出现一个弹出窗口,询问他们是否要提交选择。 I've been adding to the view, and I just noticed that although the form works properly, I no longer receive a popup asking to confirm the selection. 我一直在添加到视图中,我只是注意到尽管表单可以正常工作,但我不再收到弹出窗口要求确认选择。

This consists of two tables. 这由两个表组成。 An upper one to display info where each row has a checkbox. 上面的一个显示信息,每行都有一个复选框。 The bottom table allows you to choose if you want to submit only selected checkboxes, or all of the rows in the table. 底部的表格允许您选择只提交选定的复选框,还是只提交表格中的所有行。

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

You have a typo in the onsubmit option. 您在onsubmit选项中有一个错字。 Look at your quotes. 看你的报价。 Im guessing this line: 我猜这行:

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

should be: 应该:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM