How To Put A Post Link Into Cdetailview In Yii

i have a view page using CDetailView,

    <?php $this->widget('zii.widgets.CDetailView', array(










    )); ?>

the function getKeywordsHtml() is defined in same file as below.


    function getKeywordsHtml($model)




        foreach ($model->keywords as $keyword)


            $keywordsHtml = $keywordsHtml.

                            CHtml::link($keyword->name,array('keyword/view', 'id'=>$keyword->id)).


                            CHtml::link(' [del] ',

                                array('problem/delkeyword', 'id'=>$model->id, 'kid'=>$keyword->id), 







                                'class' => 'delete',

                                'confirm'=>'Are you sure?'




        return $keywordsHtml;           



I want the page to show the keyword with a del link beside it.

now the link works fine. it goes to the /delkeyword&id=1, but the confirm window didn’t work. so it the post doesn’t work.

I tried the following code outside the detail widget, it works fine.


        echo CHtml::link('keyword 1',array('keyword/view','id'=>1)).CHtml::link(' [del] ',array('problem/delkeyword','id'=>1, 'kid'=>1), array('submit'=>array('/problem/delkeyword', 'id'=>1, 'kid'=>1),'class' => 'delete','confirm'=>'Are you sure?')).'<br>';


And the html output

work outside CDetailview:

    <a class="delete" href="#" id="yt3"> [del] </a> 

not work in CDetailview:

    <a class="delete" href="#" > [del] </a>

So how should i modify my code?


I have seen two points here

First thing is … you dont have ID for your link… just try with that. because that is the only difference

second thing is where is kid in your URL… i cannot see KID .but you are passing in your URL

For confirm button, its better to use ajax reques and send data using post method