How to use "Are you sure?" message in Controller?

I am sure that it must have been discussed several time in the forum. I did some search but could not find what I am looking for.

i. Is it possible to display a confirmation message, e.g. "Are you sure that you want to empty the cart?" on choosing an option from menu? How?

ii. How can I display a confirmation message in Controller’s action and take a decision based on the selection ?

if you want to put confirmation in the link you can use like this :

<?php echo CHtml::link("Delete", "#", array("submit"=>array("MyController/delete","id"=>"$model->id" ),"confirm"=>"Are you sure?")); ?>

Thanks. That works.

I would prefer to display the confirmation message when the user chooses an option from the menu. At present, my menu is based on the SMenu extension (