Maison >développement back-end >tutoriel php >yii?删除按钮问题
Views->index.php: 'delete' => array ( 'label'=>'Delete Record', 'imageUrl'=>Yii::app()->request->baseUrl.'/images/list_del.gif', url'=>'Yii::app()->createUrl("series/delete", array("id"=>$data->id,"menu"=>Yii::app()->controller->curmenu))', ),Controller: public function actionDelete($id) { if($id==4) { $model = $this->loadModel($id); $model->delete(); if (!isset($_GET['ajax'])) $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin')); }else{ /*echo("<script>alert(1);</script>");*/ //不会弹出错误信息框?//当id不等于4时,弹出一个错误信息 ( 这部分未实现) } }
不懂,看你这样应该能弹出来啊
不懂,看你这样应该能弹出来啊
Views->index.php:
'delete' => array
(
'name'=>'deletename', //根本没用
'htmlOptions'=>array('name'=>'deletename'),//这样呢
'label'=>'Delete Record',
'imageUrl'=>Yii::app()->request->baseUrl.'/images/list_del.gif',
url'=>'Yii::app()->createUrl("series/delete", array("id"=>$data->id,"menu"=>Yii::app()->controller->curmenu))',
),
还有一种办法,delete的时候加个判断,如果等于4,直接不会提示删除链接,并且在controller里面加个判断是否为4.
还有一种办法,delete的时候加个判断,如果等于4,直接不会提示删除链接,并且在controller里面加个判断是否为4.