At last I've successfully activating CSRF in YiiPlayGround without any major problem. Few months ago, I've tried to enabling it but then it made CStarRating ajax post become unrunnable, so I disabled it back.
As long as we stick the way of Yii in creating form (using CHtml::beginForm()) then it will run like usual. The problem is because of the CSRF activated, every form will have a token which will validated on the controller. Since my CStarRating using POST when running Ajax (without putting token) it cannot be run. Now I got the solution by putting it manual in my parameter like this :
$this->widget('CStarRating',array(
'name'=>'ratingAjax',
'callback'=>'
function(){
$.ajax({
type: "POST",
url: "'.Yii::app()->createUrl('UiModule/ui_other/starRatingAjax').'",
data: "'.Yii::app()->request->csrfTokenName.'='.Yii::app()->request->getCsrfToken().'&rate=" + $(this).val(),
success: function(msg){
$("#result").html(msg);
}})}'
));Hope this is the right approach...

Help















