这是我的html视图文件:
<?php foreach($this->application as $row): ?>
<tr>
<td><?php echo $row['APPID'];?></td>
<td><?php echo $row['APPNAME'];?></td>
“&GT; DELETE
这是我的zend框架控制器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
选项的用户确认。
我该怎么做?
答案 0 :(得分:0)
在您的视图中,您可以添加一个弹出框:
if (window.confirm('Are you sure you want to delete?'))
{
window.location = "<?php echo $this->url('delete', array('action'=>'delete', 'id' => $example->getId())) ?>"
}
查看示例here。