Popup window on clicking Operations link

Hi all,

I am a yii newbie. I have searched on the forum but couldn’t find any reference on how to call a javascript function from view, Operations link to show popup box.

Here is what I have done,


//the javascript that doing the jobs

$script ="function myPopup() {




//put the script to the view

Yii::app()->clientScript->registerScript(‘js1’, $script, CClientScript::POS_END);



array(array(‘label’=>‘New Appointment’,‘url’=>array(‘appointment/create’, ‘patient_id’=>$model->patient_id,array(‘onclick’=>‘myPopup()’)))


Any help will be much appreciated, thanks.

Try such code:

$this->menu = array(

  array('label' => 'New Appointment', 'url' => array('appointment/create', 'patient_id' => $model->patient_id), 'linkOptions' => array('onclick' => 'myPopup()')),


and change POS_END to POS_HEAD.

Thanks a lot direlict, thats perfect! works! am very happy:)

Much appreciate your quick reply.

I need a help when I click on pagination button I should get a facebook share popup. How.to get tat