[英]How to call a CJuidialog through action in Yii
我正在做一個需要通過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'));
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.