Tuesday, May 14, 2013

YII: Create a Delete Button with Post Action and Confirmation Dialog

Here is how to create a delete button or link with post action and also add confirmation dialog.

echo CHtml::link("Delete", '#', array('submit'=>array('post/delete', "id"=>$data->id), 'confirm' => 'Are you sure you want to delete?'));






In order to delete, you must pass variable through post action, not get action, so here is how you can make a delete button.


1 comment:

Unknown said...

So usefull !
I was searching for a long time.

Thank you very much.

le_o