Javascript 如何在Yii中通过操作调用CJuidialog

Javascript 如何在Yii中通过操作调用CJuidialog,javascript,yii,modal-dialog,Javascript,Yii,Modal Dialog,我正在做一个需要通过actionCreate调用CJuidialog的项目。有办法吗?我只想有一个简单的对话框,其中包含一些文本和按钮提交和取消,如果它满足我的条件。以下是我的开始 public function actionCreate() { $model=new EmpSched; // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidat

我正在做一个需要通过actionCreate调用CJuidialog的项目。有办法吗?我只想有一个简单的对话框,其中包含一些文本和按钮提交和取消,如果它满足我的条件。以下是我的开始

public function actionCreate()
{
    $model=new EmpSched;

    // Uncomment the following line if AJAX validation is needed
    // $this->performAjaxValidation($model);

    if(isset($_POST['EmpSched']))
    {
        $model->attributes=$_POST['EmpSched'];
        if($model->default==1){

            Yii::app()->clientScript->registerScript('my_script', 'alert("Hi     there!");', CClientScript::POS_READY);

        }else{
            ($model->save());
                $this->redirect(array('view','id'=>$model->id_empsched));
        }

    }

    $this->render('create',array(
        'model'=>$model,
        'emp'=> new CActiveDataProvider('schedule'),
    ));
}
以下是输出:

!![在此处输入图像描述][1]


我遇到的问题是,在actionCreate中,我无法在我的条件下调用CJuidialog如果满足我的条件,我想显示对话框,如果不只是保存的话。

在yii中,htmlOptions中有一个确认键:

echo CHtml::button('Delete', array('submit' =>Yii::app()->createUrl("/post/delete", array("id" => $model->id)), 'confirm'=>'Are you sure?', 'name'=>'delte'));