sasori
(Nemo Md5)
1
hi,
$this->menu=array(
array('label'=>'CV Listings', 'url'=>array('index')),
#array('label'=>'Create CV', 'url'=>array('create')),
array('label'=>'Update CV', 'url'=>array('update', 'id'=>$model->ResumeID)),
array('label'=>'Delete CV', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->ResumeID),'confirm'=>'Are you sure you want to delete this item?')),
#array('label'=>'Manage Wsrecruitcvhead', 'url'=>array('admin')),
array('label'=>'Add References', 'url' => array('wsrecruitreferences/create', 'id' => $model->ResumeID)),
array('label'=>'Add Recruit Time', 'url' => array('wsrecruittimes/create', 'id' => $model->ResumeID)),
array('label'=>'Add Education', 'url' => array('wsrecruiteducation/create', 'id' => $model->ResumeID)),
array('label'=>'Add Work History','url' => array('wsrecruitworkhistory/create', 'id' => $model->ResumeID)),
);
see the "Delete CV" link above ?
I want that functionality and put it inside the
CHtml::link()…is that possible ? how ?
junxiong
(Junxiong)
2
if you mean CHtml to have confirmation alert then you can write like this:
CHtml::link(t("Delete"), "#", array("submit"=>array("delete","id"=>"$model->id" ),"confirm"=>"Are you sure?"));
sasori
(Nemo Md5)
3
Thanks, though there’s a bit of correction to your code,it should be
CHtml::link("Delete","#",array("submit"=>array("delete","id"=>"$model->id"),"confirm"=>Are you sure?"));
I don’t know what’s the wrapping of “Delete” with t() for ?
and how to redirect the user to the same page if it was confirmed ?
junxiong
(Junxiong)
4
I am sorry, just ignore the t() function…
it is actually a shortcut function from Yii::t() function for translating…
if you want to link back to here just give an empty array on the url parameter
echo CHtml::link("Delete","#",array("submit"=>array("id"=>"2"),"confirm"=>"Are you sure?"));
PS: are you sure you must omit the first quote on the string “Are you sure?” ? Because it’s error on my machine.
sasori
(Nemo Md5)
5
its a typo error of mine 
but many thanks for the help 