当用户点击提交按钮时,会出现一个弹出窗口,询问他们是否希望提交选择。我一直在添加视图,我只是注意到虽然表单工作正常,但我不再收到弹出窗口要求确认选择。
这包括两个表格。一个上面一个显示信息,每行有一个复选框。底部表格允许您选择是否只提交选定的复选框或表格中的所有行。
<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>
答案 0 :(得分:1)
onsubmit
选项中有拼写错误。看看你的报价。我猜这一行:
'onsubmit'=>'return confirm("Are you sure you want to archive?'));
应该是:
'onsubmit'=>'return confirm("Are you sure you want to archive?")');