1

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

这由两个表组成。上一个显示每行都有一个复选框的信息。底部表格允许您选择是仅提交选定的复选框,还是提交表格中的所有行。

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

1 回答 1

1

onsubmit您在选项中有错字。看看你的报价。我猜这一行:

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

应该:

 'onsubmit'=>'return confirm("Are you sure you want to archive?")');
于 2013-06-05T01:20:49.950 回答