CStarRating resetValue not used

If I set resetValue of a CStarRating widget to 0, "0", 1, "1" or anything else and the user clicks on the Cancel Rating button, the $POST value for the corresponding attribute is not set at all. If the user selects any number of stars, it works OK.

Am I doing something wrong or this is a bug?

Ok, is there anybody here, who uses CStarRating and when the user clears stars, he gets resetValue as described in the API?

same problem

I think it is bug too. I have tested it and it doesn’t work as described in the References. Maybe you want to open ticket about this?

Anyway I think the current solution would be writing something like this:




echo CHtml::beginForm();


echo CHtml::hiddenField('score','1'); //put reset value in the hiddenField. And it must be above CStarRating

$this->widget('CStarRating',array('name'=>'score'));

echo CHtml::submitButton('ok');

echo CHtml::endForm();



It works on my Firefox 6. Not test it yet on other browsers

And if you want to use Star Rating with Ajax?

you can use the following code for resetValue to be posted to you rating controller.

$(document).ready(function(){

	$(".rating-cancel a").live('click',function(){


	  


            $.ajax({


                type: "POST",


                url: "CONTROLLER URL",


                data: "rate=RESETVALUE" ,


                


                success: function(msg){


                            $("#result").html(msg);


                    }


                })


    });


    });