CHtml::link() in CGridView column with a confirm parameter

Hi All,

Just want to find out if this is valid bug before reporting?

I have created a column in CGridView widget which creates a CHtml::link() with a confirm parameter. The jQuery is generated perfectly but the link id is not created to correspond with the jQuery.

Example column in CGridView :


....


array(

            'value'=>'CHtml::link( \'Delete\', array(\'messages/delete\',\'id\'=>$data->msg_id) , array(\'confirm\'=>\'Are you sure you wish to Delete this message?\',\'title\'=>\'Delete Message\') )', 

            'type'=>'html',

       ),


....

hello this example should work

the first item in the array inside the link is the controller/action

while the subsequent key/value pairs is/are the values to be posted.

‘columns’=>array(

		array('name'=>'title',


			  'type'=>'raw',


			  'value'=>'CHtml::link($data->title,array("post/view","id"=>$data->id))'),

Hi binkabir

Thanks for your reply. I changed my ‘type’ parameter to ‘raw’ and it now works perfectly. Why would the type matter when CHtml::link creates the hyperlink and more specifically not include an HTML id attribute? The definition of the ‘html’ attribute is 'html: the attribute value will be purified and then returned. ’ - does this mean stripping out the id attribute of the <a> tag?

thanks.

the “type” of the attribute value. This determines how the attribute value is formatted for display. Valid values include those recognizable by CGridView::formatter, such as: raw, text, ntext, html, date, time, datetime, boolean, number, email, image, url. For more details, please refer to CFormatter. Defaults to ‘text’ which means the attribute value will be HTML-encoded.