这是我的HTML视图文件:
<?php foreach($this->application as $row): ?>
<tr>
<td><?php echo $row['APPID'];?></td>
<td><?php echo $row['APPNAME'];?></td>
">删除
这是我的Zend Framework控制器deleteAction
:
public function deleteAction()
{
$form = new ApplicationForm();
$form->submit->setlabel('Delete');
$this->view->form = $form;
$ID = $this->_getParam('ID', 0);
$delete_app = new Application()
$delete_app->deleteApp($ID);
$this->_helper->redirector('index');
}
目前,我的删除操作正常。现在,在执行删除之前,我想添加用yes | no
选项添加用户确认。
我该怎么做?
在您的视图中您可以添加一个弹出框:
if (window.confirm('Are you sure you want to delete?'))
{
window.location = "<?php echo $this->url('delete', array('action'=>'delete', 'id' => $example->getId())) ?>"
}
请参阅此处的示例。