[SOLVED]delete link problem



	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 ?

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?"));

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 ?

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.

its a typo error of mine :)

but many thanks for the help :)